moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.77k stars 245 forks source link

can't listen mouse when mouse in windows Task Manager #489

Closed dade68 closed 2 years ago

dade68 commented 2 years ago

Description when move mouse in windos task mannger, listener can't capture mouse positon and movement

Platform and pynput version Windows10

To Reproduce from pynput import keyboard from pynput import mouse from datetime import datetime

def on_press(key): try: print(f'{key.char} down') except AttributeError: print(f'{key} down')

def on_release(key): print(f'{key} up')

def on_move(x, y): print('move to ', x, y)

def on_click(x, y, button, pressed): if pressed == False: print('click at ', x, y, button, pressed) print(datetime.now().isoformat(timespec='microseconds'))

def on_scroll(x, y, dx, dy): print('scroll at ', x, y, 'by', dx, dy)

def listen_mouse(): listener = mouse.Listener( on_move=None, on_click=on_click, on_scroll=on_scroll ) listener.start()

if name == 'main': listen_mouse() while True: pass

dade68 commented 2 years ago

i found that the listener function can't listen mouse when mouse move in some windows, such as task manager in windows system

moses-palmer commented 2 years ago

Thank you for your report.

This is caused by the Windows access control and isa security feature of the operating system. The limitation cannot be worked around in this library, so I will close this issue as there is unfortunately nothing to do.