Hi. I have two modules:
main.py--------------------- from tkinter import * from tkinter import ttk from code import Option class App: def __init__(self, master): master.protocol("WM_DELETE_WINDOW",Option.quit) master = Tk() master.geometry('640x480') app = App(master) master.mainloop() code.py--------------------- from tkinter import messagebox from tkinter import * from tkinter import ttk class Option: def quit(): if messagebox.askyesno(message='Close window'): master.quit() I want to press the close button and close the main window to run the module main.py. But I can not, the error it throws is: "NameError: global name 'master' is not defined" I appreciate any suggestions. Regards. Cristia AbarzĂșa _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss