The OptionMenu
widget in tkinter does not have a get()
method by default, which is what causes the AttributeError
. To resolve this, you can create a custom function to get the value of the OptionMenu
widget.
Here's an example code snippet:
main.py548 chars22 lines
In the example above, we create a custom function called get_selected_option()
that uses the get()
method on the StringVar
object to retrieve the currently selected option in the OptionMenu
widget. We then create a button that calls this function when clicked.
gistlibby LogSnag