问题
Wondering if there's a menu event I can bind to that's related to the currently selected menu item? By menu item I mean the items that show up in a popup menu like New, Open, Save, etc.
Use case: I would like to update a statusbar area of our application with a description of the currently selected menu item.
Any ideas appreciated.
Thank you, Malcolm
回答1:
You need to bind to the <<MenuSelect>>
event.
回答2:
There's an <Enter>
event that is triggered when the mouse pointer enters a widget's space. Depending on how you're building your menu, you may be able to use it.
See http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm for more
来源:https://stackoverflow.com/questions/4220441/python-tkinter-bind-to-event-related-to-currently-selected-menu-item