请帮助修复脚本:
import tkinter
class Application(tkinter.Frame):
def __init__(self, parent):
tkinter.Frame.__init__(self, parent, bg='yellow')
self.pack(side = 'top', fill = 'x')
self.make_elements()
def make_elements(self):
tollbarFrame=tkinter.Frame(self)
tollbarFrame.pack(side='top', fill='x')
tool3=tkinter.Button(tollbarFrame, text='Add record', command=self.add_record())
tool3.pack(side='left')
contentFrame=tkinter.Frame(self)
contentFrame.pack(side='top', fill='x')
butt = tkinter.Button(contentFrame, text='qwerer')
butt.pack()
def add_record(self):
child = tkinter.Toplevel()
bu = tkinter.Button(child, text='sdfsf')
bu.pack()
if __name__ == '__main__':
root = tkinter.Tk()
root.title('dvd list')
root.geometry('700x500')
Application(root)
root.mainloop()
一旦你加载一个子窗口显示“子”。我对这个子窗口的想法应该在用户单击“添加记录”按钮后出现。你知道吗
创建按钮时,不要调用回调函数。更改为:
相关问题 更多 >
编程相关推荐