I am making a database application for a school coursework project. I have a login screen which takes the user into the main menu screen. From there, the user can open up a customer form. I want to be able to close the form using a button, however, whenever I try to do this, the entire program stops running. Does anyone have a solution to this problem? I have attached a snippet of the code which includes the quit() function applied to the button, along with images of the form. Please leave a comment if you would like more information.
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()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…