Saturday, 31 August 2013

Python Tkinter OptionMenu command Exception

Python Tkinter OptionMenu command Exception

I want to create a tkinter OptionMenu that edits another OptionMenu when
it's changed. So I tried to create a command= argument which makes a
specific command run on every update of the OptionMenu, like it does when
I pass the command-Argument to a button, spinbox etc.
tl.wktype = OptionMenu(tl,wktypevar, *wk_types,command=typeupdate)
somewhere else in the code is the typeupdate() Command - for debug
purposes right now.
def typeupdate():
typeval = tl.wktype.get()
print(typeval)
The exception python throws is the following:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python33\lib\tkinter\__init__.py", line 1475, in __call__
return self.func(*args)
File "C:\Python33\lib\tkinter\__init__.py", line 3300, in __call__
self.__callback(self.__value, *args)
TypeError: typeupdate() takes 0 positional arguments but 1 was given
what positional arguments does typeupdate() think is given to it and how
do I fix this?

No comments:

Post a Comment