Python/Tkinter: bind to event related to currently selected menu item

僤鯓⒐⒋嵵緔 提交于 2020-01-06 07:00:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!