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.
Hi,
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.set("True")
# mOpvar1.trace_add('write', self.writevalue)
widget=tk.OptionMenu(self, mOpvar1, *mOption1)
widget.place(x=d+380, y=j+30)
print (widget)
def callback(*args):
dd = mOpvar1.get()
self.widgets.append(args)
mOpvar1.trace('w', callback)