user19911303
user19911303

Reputation: 449

Aligning Tkinter checkbutton text characters to left

I'm using Python 2.7 to display 2 Checkbuttons. If I use justify = LEFT it displays an error "global name 'LEFT' is not defined"

class simple_ap(Tkinter.Tk):
    def __init__(self,parent):
        Tkinter.Tk.__init__(self,parent)
        self.parent = parent
        self.initialize()

    def initialize(self):


        Checkbutton = Tkinter.Checkbutton(self,text='All_1',width = 50,justify = LEFT)
        Checkbutton.grid(column = 0, row = 0)

        Checkbutton = Tkinter.Checkbutton (self,text='To_check_for_the_space_between_brackets',width = 50)
        Checkbutton.grid(column = 0, row = 8)

if __name__ == "__main__":
    app = simple_ap(None)
    app.title('my_app')
    app.mainloop()

Is this the correct way to use "justify"? I worked off of http://www.tutorialspoint.com/python/tk_frame.htm

Upvotes: 4

Views: 8827

Answers (1)

Tim
Tim

Reputation: 12174

It appears as if you are using import Tkinter rather than from Tkinter import *, which is used in the sample you linked.

You need to use Tkinter.LEFT.

Upvotes: 5

Related Questions