0

im trying to check if a keybutton or a mousebutton is pressed but 'is_pressed' gives me false.

i dont think im doing anything wrong but is there something im missing?

import mouse
import keyboard
import time    

class Test:
    def keytest(self):
        keyboard.press('a')
        time.sleep(1)
        print (keyboard.is_pressed('a'))
        return
            

a = Test()
a.keytest()

also the below code actually clicks a rightbutton. i thought release was supposed to not click anything but just release the keys that are pressed. so i dont know whats going on with this code as well. can someone explain?

import mouse
mouse.release('right')
kerz
  • 67
  • 6

0 Answers0