I have this code that listens to mouse events and uses suppress = True
to prevent the
events from being passed to the rest of the system. (Locking the mouse in position and blocking all inputs).
def on_move(x, y):
print(x, y)
def on_click(x, y, button, pressed):
print(button, pressed
def on_scroll(x, y, dx, dy):
print(dx, dy)
with pynput.mouse.Listener(on_move=on_move, on_click=on_click, on_scroll=on_scroll, suppress=True) as listener:
listener.join()
The problem is that I only want to suppress the input of the mouse (on_click
, on_scroll
) and not the movement (on_move
).
How can I do this?
You may take a look at "How do I suppress specific events only?" section in: https://pynput.readthedocs.io/en/latest/faq.html
The provided solutions are for Windows and MacOS, but not for Linux.