老师,关于这行代码
.label01=Label(,=)
换成
self.label01=Label(root,text="用户名")
就报错,为什么呢?还是理解不了root和self的区别,代码如下:
tkinter *
tkinter messagebox
Application(Frame):
(,master=):
().(master)
.master=master
.pack()
.createWidget()
createWidget():
.label01=Label(,=)
.label01.grid(=,=)
.entry01=Entry()
.entry01.grid(=,=)
Label(,=).grid(=,=)
Label(,=).grid(=,=)
Entry(,=).grid(=,=)
Button(,=).grid(=,=,=EW)
Button(, =).grid(=, =, =E)
__name__==:
root = Tk()
root.geometry()
app = Application(=root)
root.mainloop()
为什么app =Application(master=root)里面要加这个master =root?
def __init__(self,master=None):
这里面为什么要设置master = None?