This code will suppress the mouse events
pynput.mouse.Listener(on_move=onMove, on_click=onClick, on_scroll=onScroll, suppress=True)
but I want something like
def on_move(x,y):
if(something):
resend(x,y)
else:
//do something
I tried to resend using
pynput.mouse.Controller().move(x,y) and pyautogui.moveRel(x,y)
but it didn't work.
Ok, I don't understand why you would want to do this, but here's what I came up with:
This should work. We run through a while loop, constantly checking if the condition is True/False depending on the function. We return False from the function (and therefore stop the listener) when the condition is not met. After the
elsestatement is finished, the loop starts over again (and therefore we repeat). In this fashion, this works forever.This would be really hard to do if the condition was something like if the key shift is pressed.