def on_click(x,y, button, pressed): if pressed: if len(allActions) != 0 and allActions[-1].actionType == "keyPress" and allActions[-1].getKey() == keyboard.Key.esc: return False if str(button) == "Button.middle": return False else: newClick = Action("click") newClick.setPosition(x, y) newClick.setButton(str(button)) allActions.append(newClick)
def on_scroll(x,y,dx,dy): newScroll = Action("scroll") newScroll.setPosition(x, y) newScroll.setSpeed(dx, dy) allActions.append(newScroll)