【发布时间】:2021-04-17 13:53:54
【问题描述】:
我正在为学校课程项目制作数据库应用程序。我有一个登录屏幕,可将用户带入主菜单屏幕。从那里,用户可以打开一个客户表格。我希望能够使用按钮关闭表单,但是,每当我尝试这样做时,整个程序都会停止运行。有没有人可以解决这个问题?我附上了代码的 sn-p,其中包括应用于按钮的 quit() 函数以及表单的图像。如果您想了解更多信息,请发表评论。
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
global prog_location
prog_call = sys.argv[0]
prog_location = os.path.split(prog_call)[0]
root = tk.Tk()
top = CustomerForm (root)
CustomerForm_support.init(root, top)
root.mainloop()
w = None
def create_CustomerForm(rt, *args, **kwargs):
'''Starting point when module is imported by another module.
Correct form of call: 'create_CustomerForm(root, *args, **kwargs)' .'''
global w, w_win, root
global prog_location
prog_call = sys.argv[0]
prog_location = os.path.split(prog_call)[0]
#rt = root
root = rt
w = tk.Toplevel (root)
top = CustomerForm (w)
CustomerForm_support.init(w, top, *args, **kwargs)
return (w, top)
class CustomerForm:
def quit(self):
root.destroy()
【问题讨论】:
标签: python sqlite user-interface tkinter