Coder Social home page Coder Social logo

add feature TextBox about customtkinter HOT 5 CLOSED

mikdevind avatar mikdevind commented on June 3, 2024
add feature TextBox

from customtkinter.

Comments (5)

Akascape avatar Akascape commented on June 3, 2024

@mikdevind The textbox widget is similar to the text widget of tkinter and both don't have the justify option directly, you have to use tag method like mentioned here:

https://www.tutorialspoint.com/how-to-set-justification-on-tkinter-text-box

from customtkinter.

mikdevind avatar mikdevind commented on June 3, 2024

inputanSearch.tag_configure("center", justify='center')
AttributeError: 'CTkTextbox' object has no attribute 'tag_configure'

program is
inputanSearch = tk.CTkTextbox(FrameHome, wrap="none",font=("Times", 20), height=45, width=890)
inputanSearch.grid(row=0, column=0, padx=3, pady=5)
inputanSearch.tag_configure("center", justify='center')

from customtkinter.

Akascape avatar Akascape commented on June 3, 2024

@mikdevind
Try this:

import customtkinter

class App(customtkinter.CTk):
    def __init__(self):
        super().__init__()
        self.grid_rowconfigure(0, weight=1)  # configure grid system
        self.grid_columnconfigure(0, weight=1)

        self.textbox = customtkinter.CTkTextbox(master=self, width=400, corner_radius=0)
        self.textbox.grid(row=0, column=0, sticky="nsew")
        
        self.textbox._textbox.tag_configure("text", justify='center') # first, justify text position using tag_configure

        self.textbox.insert("0.0", "Some example text!\n" * 20) # insert all the text 
    
        self.textbox._textbox.tag_add("text", "0.0", "end") # add this line in the end


app = App()
app.mainloop()

from customtkinter.

mikdevind avatar mikdevind commented on June 3, 2024

not work for centering text in CTkTextbox

from customtkinter.

mikdevind avatar mikdevind commented on June 3, 2024

Thanks you

from customtkinter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.