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

时间:2017-08-31 08:29:28

标签: python tkinter

我尝试将键§绑定到函数:

//Modifys to set same dates    
$date1 = new DateTime('08/07/2017')->modify('d-m-Y');
$date2 = new DateTime('8/7/2017')->modify('d-m-Y');
//Difference In Days
$dateDifference = $date1->diff($date2)->format("%a");

但是,这种与密钥§的绑定不起作用。顺便说一句,它是Mac键盘上的实际键。

键盘上的其他键正在使用此代码,因此使用键“§”本身或符号“§”显然是一个问题。有人知道吗?

我正在使用Sublime文本编辑器

1 个答案:

答案 0 :(得分:3)

显然,section sign key (§)的适当绑定是<section>

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

要发现它,我们绑定<Key>(任意键),然后从涉及该键的事件中注明event.keysym