简体   繁体   中英

In Python (on Raspberry Pi) how do I create an embedded keypad within my Tkinter window

I am using Tkinter to create an application which requires a 0-9 numerical keypad to be built in to the UI. I plan to do this with 10 button widgets which enter the relevant number(s) into the currently selected Entry widget. I do not want to use one of the pre-made on-screen keyboards (eg Matchbox-keyboard) that are available, it needs to be bespoke to the application. So essentially - how do I simulate key-press events using on-screen buttons to enter values into entry fields without taking the focus off the entry field?

You don't need to simulate keypresses if all you want to do is insert the numbers into the entry widget. Just have the buttons directly insert their value into the entry widget with the entry widget insert method.

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