mouse icon indicating copy to clipboard operation
mouse copied to clipboard

mouse.is_pressed("left") trigger only one time

Open Dj-EKI opened this issue 4 years ago • 2 comments

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.

Dj-EKI avatar Apr 04 '20 10:04 Dj-EKI

I have this problem too

arch88 avatar Dec 30 '20 21:12 arch88

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)

AdroitBit avatar Aug 05 '22 10:08 AdroitBit