pynput
pynput copied to clipboard
Cant from pynput.mouse import Button, Controller in compiler
The code worked in cmd but failed in compiler:
the error is:
Traceback (most recent call last):
File "C:\Users\THINK\Desktop\exp\monitor\pynput.py", line 13, in
Thank you for your report.
What do you mean by compiler?
I think it is the same problem I got right now.
Sitting in Pycharm and learning to use Pynput with the documentation.
This code doesn't work when running it through the Pycharm terminal, but works in the real command prompt on Windows 10
The Keyboard version works in the Pycharm terminal though:
`from pynput import mouse
def on_move(x, y): print('Pointer moved to {0}'.format((x, y)))
def on_click(x, y, button, pressed): print('{0} at {1}'.format('Pressed' if pressed else 'Released', (x, y))) if not pressed: # Stop listener return False
def on_scroll(x, y, dx, dy): print('Scrolled {0} at {1}'.format('down' if dy < 0 else 'up', (x, y)))
Collect events until released
with mouse.Listener( on_move=on_move, on_click=on_click, on_scroll=on_scroll) as listener: listener.join()`