简体   繁体   中英

tkinter key binding not fully working on Raspberry pi

I wrote a code on my windows machine with python 3.7 TKinter, I bound the enter button to my function and all works great. The main enter key works, along with the number pad enter key.

I loaded the code onto my raspberry pi 3b, and the number pad enter key no longer call my function, but the main keyboard enter key does.

root.bind("<Return>", (lambda event: say_hello()))

Is there a way to make this work with both enter keys?

    root.bind("<Return>", (lambda event: say_hello()))

This refers to the Return key, while

    root.bind("<KP_Enter>", (lambda event: say_hello()))

works for the Enter key, to know more about tkinter bindings, you can refer to the following link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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