keyboard

How to suppress a pressed key using the Python package keyboard

How to suppress a pressed key using the Python package keyboard Question: I’m trying to suppress the two pressed keys ‘p’ and ‘q’ in this script. The script is build to take pictures with RPi and RPi camera, when pressing the key ‘p’. If you want to quit you press ‘q’. The function keyboard.is_pressed() works …

Total answers: 1

stuck on adding a timer to my keyboard press program

stuck on adding a timer to my keyboard press program Question: Im making a keyboard program that repeatedly presses a key every 0.1 seconds and uses esc as the hotkey to stop/start the program. import keyboard import time keyboard.wait(‘esc’) name = ("python") while name == "python": keyboard.press_and_release(‘5’) time.sleep(0.1) #this is where i want to add …

Total answers: 1

Key repeat after input in pynput

Key repeat after input in pynput Question: I basically need something to take input from and print it or something else, but whatever I press it will repeat after I (close the program, read text input, etc) here is an example: what I tried: I used the keyboard module instead of pynput module I used …

Total answers: 1

how to make program stop with a hotkey (outside the console)

how to make program stop with a hotkey (outside the console) Question: I made an autoclicker and i can stop it by pressing b but only at the right timing. I didn’t find anything that would allow me to stop the program by pressing a button at any time without accessing the console Here’s the …

Total answers: 1

How to execute certain part of the code in a While-Loop?

How to execute certain part of the code in a While-Loop? Question: This is a modified working section of my code just to make it simple. The idea is that the user enters from the main menu to a submenu, and there is asked to press ENTER to continue or ESC to return to the …

Total answers: 1

telegram bot reply message for buttons

telegram bot reply message for buttons Question: recently i created a telegram bot using python and i added keyboard button features to the bot. However, i am having difficulties in getting replies from bot to the buttons users choose. button7 = KeyboardButton(‘About Us’,request_contact= False) keyboard2 = ReplyKeyboardMarkup(resize_keyboard = True, one_time_keyboard = True).row(button7) @dp.message_handler(commands=[‘info’]) async def …

Total answers: 1

Python keyboard module add_hotkey doesn't work

Python keyboard module add_hotkey doesn't work Question: I’m trying to run some code from someone else’s GitHub repo, but it wouldn’t work. Eventually I figured out that the "keyboard.add_hotkey" function isn’t working properly on my PC (W10). I wrote this small test script to isolate the issue: import keyboard keyboard.write(‘hehe’) keyboard.add_hotkey(‘a’, lambda: keyboard.write(‘test’)) keyboard.add_hotkey(‘ctrl + …

Total answers: 1

why is this code not working with library keyboard

why is this code not working with library keyboard Question: If I press ctrl and alt at the same time, my program does nothing. I want if I press ctrl and alt at the same time python will automatically refresh the page 100 times. Does anyone know why this isn’t working and what I need …

Total answers: 1

Execute code whenever the space bar is pressed?

Execute code whenever the space bar is pressed? Question: I am making this kind of a game but it isn’t really a game so basically I want this to run every time I hit space but it doesn’t work no matter what I try so I would be really thankful if somebody could have helped …

Total answers: 2