Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1584

Python • Re: Using Python with a GUI that performs keyboard strokes

$
0
0
I have done something similar. I used the pynput library as a keyboard listener, in my case in a Kivy GUI. The program responds to Ctrl + Alt + Up or Down to select different texts, which is then copied into the clipboard with Pyperclip. So I can just paste the selected text with ctrl+V without ever leaving the program I am working with (Code, Chrome, Firefox or whatever). I found that the build-in keyboard listener with Kivy did not listen when its window was not focussed, while pynput still worked. Only trouble I encountered was to find key combinations that don't interfere with whatever program you are working in.

This saves me lots of time at work as I avoid typing all the standard stuff again and again, like "Good morning", "Thank you for reaching out to us", "Please don't hesitate to contact us..." etc.

This aproach has proven to be faster than clicking on buttons, as you actually never leave the other program, let's say Firefox. Just organize the windows next to each other and see the selected text change with a key combination.

Statistics: Posted by kheylen25 — Wed Jun 04, 2025 5:10 pm



Viewing all articles
Browse latest Browse all 1584

Trending Articles