[英]Detect specific keypresses in GUI
I'm looking for a way in Gtk/Python to have an app listen for keypresses and when some of the special keys are pressed, perform an action (recreate a menu with different labels, since it's an appindicator). 我正在寻找一种在Gtk / Python中使应用程序监听按键的方法,当某些特殊按键被按下时,执行一个操作(重新创建具有不同标签的菜单,因为它是一个指示器)。 I can't really find a way to do it though.
我确实找不到解决办法。 If anyone is able to help, I'd be thankful.
如果有人能够提供帮助,我将非常感激。
You probably need to handle the "key-press-event" (and probably also "key-release-event" ) of GtkWidget. 您可能需要处理GtkWidget的“ key-press-event” (可能还需要处理“ key-release-event” )。 PyGtk knows about it .
PyGtk知道这一点 。
It should be inside some "windowing" widget, so you may need to use GtkEventBox as a container. 它应该在某些“窗口”小部件内,因此您可能需要使用GtkEventBox作为容器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.