[Tutor] Tix: binding
hk at pop.ms
hk at pop.ms
Wed Mar 15 03:20:05 CET 2006
I am looking at Tix and I am stuck with what seems to be a simple problem:
I want to bind the cancel buttom of a ExFileSelectBox to a routine in my class, but can not make it work.
I guess the problem is the same for any binding of tix sub-widgets, so if someone could send some sample code.
>>> import Tix
>>> root = Tix.Tk()
>>> box = Tix.ExFileSelectBox(root)
>>> print box.subwidget(name='cancel')
.11827520.bf.cancel #so the sub-widget cancel buttom is there
But how to bind it ?
>>> box.cancel(command = lambda a,b : a+b )
Traceback (most recent call last):
File "<pyshell#12>", line 1, in ?
box.cancel(command = lambda a,b : a+b )
AttributeError: _dummyButton instance has no __call__ method
Or
>>> box.subwidget(name='cancel' , command = lambda a,b : a+b )
Traceback (most recent call last):
File "<pyshell#13>", line 1, in ?
box.subwidget(name='cancel' , command = lambda a,b : a+b )
TypeError: subwidget() got an unexpected keyword argument 'command'
So, it seems I can not bind to command, but what then ?
>From the Tix docu I thought the buttoms are normal Tkinter widgets ?
--
Harm
More information about the Tutor
mailing list