Reputation: 3119
I have a cascade menu in a parent menu. The cascade items are created dynamically with add_checkbutton
method.
A user should be able to "check" menu items and select/confirm them. However, I don't know how to access text in the menu items, to decide which item is selected.
Obvious solution is to generate tk.StringVar
dynamically, but I would like to avoid that since it complicates the code significantly.
How to get value of the menu label/text in tkinter? Is there other solution to the problem?
Upvotes: 2
Views: 2445
Reputation: 385970
You can use the entrycget method of a menu item to get any of its attributes, including the label and value.
Upvotes: 2