[Tkinter] optionmenu value write a list - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] optionmenu value write a list (/thread-22398.html) |
optionmenu value write a list - mdalireza - Nov-11-2019 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) |