Python Forum

Full Version: optionmenu value write a list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am keep getting AttributeError: 'tuple' object has no attribute 'get' when I am trying to write to a list a value from optionmenu. Please help

mOption1 = ["True", "False"]
mOpvar1 = tk.StringVar()
# mOpvar1.trace_add('write', self.writevalue)
widget=tk.OptionMenu(self, mOpvar1, *mOption1), y=j+30)
print (widget)
def callback(*args):
dd = mOpvar1.get()
mOpvar1.trace('w', callback)