Home > Mobile >  how can i detect pressing windows key with python
how can i detect pressing windows key with python

Time:01-21

I used this one but it doesn't work for me I really need the solution please

import keyboard

while True:
    if keyboard.read_key() == "Windows":
        print("You pressed windows")
        break

CodePudding user response:

Use is_pressed() with parameter of key you want too check

import keyboard 

while True:
    if keyboard.is_pressed('Windows'): 
        print('You Pressed A Key!')
        break

CodePudding user response:

Hi i think u can use this

import keyboard 

while True:
    if keyboard.is_pressed('q'): 
        print('You Pressed A Key!')
        break
  •  Tags:  
  • Related