C
craf
Hi.
The query code is as follows:
------------------------------------------------------
import Tkinter
import tkMessageBox
class App:
def __init__(self, master):
master.protocol("WM_DELETE_WINDOW",quit)
def quit():
if tkMessageBox.askyesno('','Exit'):
master.quit()
master =Tkinter.Tk()
app = App(master)
master.mainloop()
-------------------------------------------------------
As you can see, when I run and close the main window displays
a text box asking if you want to quit, if so, closes
application.
Question:
Is it possible to define the quit() function in another separate
module?.
I tried it, but it throws the error that the global name
'master' is not defined.
Thanks in advance.
Regards
Cristian Abarzúa
The query code is as follows:
------------------------------------------------------
import Tkinter
import tkMessageBox
class App:
def __init__(self, master):
master.protocol("WM_DELETE_WINDOW",quit)
def quit():
if tkMessageBox.askyesno('','Exit'):
master.quit()
master =Tkinter.Tk()
app = App(master)
master.mainloop()
-------------------------------------------------------
As you can see, when I run and close the main window displays
a text box asking if you want to quit, if so, closes
application.
Question:
Is it possible to define the quit() function in another separate
module?.
I tried it, but it throws the error that the global name
'master' is not defined.
Thanks in advance.
Regards
Cristian Abarzúa