Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Dj-EKI opened this issue Apr 4, 2020 · 2 comments
Open

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

Dj-EKI opened this issue Apr 4, 2020 · 2 comments

Comments

@Dj-EKI
Copy link

Dj-EKI commented Apr 4, 2020

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.

@arch88
Copy link

arch88 commented Dec 30, 2020

I have this problem too

@AdroitBit
Copy link

AdroitBit commented Aug 5, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants