hello i want to intercept tkinter python system events like
wm_delete_windo w
and if possible for any window, but the newest code I've produced give
me
an error :
Traceback (most recent call last):
File "C:\Documen ts and Settings\yvesd\ Bureau\protowin .py", line 36,
in ?
b1 = Tkinter.Button (win1)
File "C:\Python24\li b\lib-tk\Tkinter.py", line 1933, in __init__
Widget.__init__ (self, master, 'button', cnf, kw)
File "C:\Python24\li b\lib-tk\Tkinter.py", line 1856, in __init__
BaseWidget._set up(self, master, cnf)
File "C:\Python24\li b\lib-tk\Tkinter.py", line 1834, in _setup
self.tk = master.tk
AttributeError: MyDlg instance has no attribute 'tk'
thanks a lot for the help answer.
here is my code :
import Tkinter
from Tkinter import *
class MyDlg(Toplevel) :
def ma_fonction():
print "my function is finished."
def __init__(arg1, arg2):
arg1.protocol(" WM_DELETE_WINDO W", arg1.ma_fonctio n)
root = Tkinter.Tk ()
#win1 = Tkinter.Topleve l (root)
win1 = MyDlg(root)
b1 = Tkinter.Button (win1)
b1.config (text="hello")
wm_delete_windo w
and if possible for any window, but the newest code I've produced give
me
an error :
Traceback (most recent call last):
File "C:\Documen ts and Settings\yvesd\ Bureau\protowin .py", line 36,
in ?
b1 = Tkinter.Button (win1)
File "C:\Python24\li b\lib-tk\Tkinter.py", line 1933, in __init__
Widget.__init__ (self, master, 'button', cnf, kw)
File "C:\Python24\li b\lib-tk\Tkinter.py", line 1856, in __init__
BaseWidget._set up(self, master, cnf)
File "C:\Python24\li b\lib-tk\Tkinter.py", line 1834, in _setup
self.tk = master.tk
AttributeError: MyDlg instance has no attribute 'tk'
thanks a lot for the help answer.
here is my code :
import Tkinter
from Tkinter import *
class MyDlg(Toplevel) :
def ma_fonction():
print "my function is finished."
def __init__(arg1, arg2):
arg1.protocol(" WM_DELETE_WINDO W", arg1.ma_fonctio n)
root = Tkinter.Tk ()
#win1 = Tkinter.Topleve l (root)
win1 = MyDlg(root)
b1 = Tkinter.Button (win1)
b1.config (text="hello")
Comment