简体   繁体   English

在Python中将“§”键绑定到按钮

[英]Binding “§” key to button in Python

I try to bind key § to a function: 我尝试将键§绑定到一个函数:

top.bind("§", lambda x: startRecognition(v, label2, top))

However, this binding with key § is not working. 但是,与键§的绑定无效。 It is an actual key on Mac keyboard by the way. 顺便说一句,它是Mac键盘上的实际键。

Other keys on the keyboard are working with this code, so it is clearly a problem either with the key "§" itself or the symbol '§'. 键盘上的其他键都与此代码一起使用,因此显然键“§”本身或符号“§”都存在问题。 Anyone knows? 有谁知道?

I'm using Sublime text editor by the way 我正在使用Sublime文本编辑器

Apparently, the appropriate binding for the section sign key (§) is <section> : 显然, 段符号键(§)的适当绑定是<section>

top.bind("<section>", lambda x: startRecognition(v, label2, top))

To discover it, we bound <Key> (any key), then noted the event.keysym from events that involved that key. 为了发现它,我们绑定了<Key> (任何键),然后从涉及该键的事件中记下event.keysym

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM