Python/Tkinter: bind to event related to currently

2019-09-14 11:41发布

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

2条回答
狗以群分
2楼-- · 2019-09-14 12:01

You need to bind to the <<MenuSelect>> event.

查看更多
虎瘦雄心在
3楼-- · 2019-09-14 12:12

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

查看更多
登录 后发表回答