[Tutor] Event handler for optionmenu

geon geon at post.cz
Mon Aug 15 14:24:54 CEST 2005

Jorge Louis de Castro napsal(a):

>Thanks for your reply. It wasn't lazyness, believe me, I did look around for 
>solutions and found something similar to yours here:
>The problem is that I have a class and it wants the callback function to be 
>a global name (I also can't figure out hot to pass parameters to it)
>By being a global name I can't access the var with widget.getvar(), and it 
>complains if I use root by saying:
>Exception in Tkinter callback
>Traceback (most recent call last):
>  File "C:\Python24\Lib\lib-tk\Tkinter.py", line 1345, in __call__
>    return self.func(*args)
>  File "C:\Workplace\python\piim\Tkclient.py", line 312, in doLangChoices
>    varValue = root.getvar(name)
>AttributeError: Tkclient instance has no attribute 'getvar'
Not sure what Tkclient() is... seems to be not child od Tk(), cause 
there is no getvar() function...
Anyway I am not able to run your script cause you used there both tabs 
and spaces for indentation. (see the row OPTIONS = 
["en","pt","es","it","fr","de"], how much it is intended....)

Shoudnt be there varValue = self.startw.getvar(name)? - just guessing - 
I can not check cause the indentation i scorrupted ;-)


More information about the Tutor mailing list