Y
yvesd
hello i want to intercept tkinter python system events like
wm_delete_window
and if possible for any window, but the newest code I've produced give
me
an error :
Traceback (most recent call last):
File "C:\Documents and Settings\yvesd\Bureau\protowin.py", line 36,
in ?
b1 = Tkinter.Button (win1)
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1933, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1856, in __init__
BaseWidget._setup(self, master, cnf)
File "C:\Python24\lib\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_WINDOW", arg1.ma_fonction)
root = Tkinter.Tk ()
#win1 = Tkinter.Toplevel (root)
win1 = MyDlg(root)
b1 = Tkinter.Button (win1)
b1.config (text="hello")
wm_delete_window
and if possible for any window, but the newest code I've produced give
me
an error :
Traceback (most recent call last):
File "C:\Documents and Settings\yvesd\Bureau\protowin.py", line 36,
in ?
b1 = Tkinter.Button (win1)
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1933, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1856, in __init__
BaseWidget._setup(self, master, cnf)
File "C:\Python24\lib\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_WINDOW", arg1.ma_fonction)
root = Tkinter.Tk ()
#win1 = Tkinter.Toplevel (root)
win1 = MyDlg(root)
b1 = Tkinter.Button (win1)
b1.config (text="hello")