4

Python 2.7 を使用して 2 を表示していますCheckbuttons。使用するjustify = LEFTとエラーが表示されます"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()

これは「正当化」の正しい使い方ですか?私はhttp://www.tutorialspoint.com/python/tk_frame.htmで作業しました

4

1 に答える 1

5

リンクしたサンプルで使用されているimport Tkinterではなく、使用しているように見えます。from Tkinter import *

を使用する必要がありますTkinter.LEFT

于 2012-11-26T07:13:59.363 に答える