mouse
mouse copied to clipboard
mouse.is_pressed("left") trigger only one time
while True: print(mouse.is_pressed("left"))
When I press the left mouse button, I get a true until I release the mouse button. If I repeat this again, then I only get False.
Edit: I could notice when I move a window that I get True when I release a False. If I move the same window again, I get a false. It is all random.
mouse Modul Version 0.7.1 Tested with Python 3.7 x64 and 3.8 x32. I have Windows 10 x64.
I have this problem too
I "workaround" this problem by using pynput instead.
from pynput import mouse
is_mouse_pressed=False
def mouse_hook(x, y, button, pressed):
global is_mouse_pressed
if button==mouse.Button.left:
is_mouse_pressed=pressed
listener = mouse.Listener(on_click=mouse_hook)
listener.start()
while True:
print(is_mouse_pressed)