[Tkinter-discuss] as close windows by separate modules
craf
prog at vtr.net
Wed Dec 15 23:23:05 CET 2010
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
More information about the Tkinter-discuss
mailing list