Max F
Max F

Reputation: 37

Check if mouse up or mouse down with pyHook?

I'm trying to detect whether or not the left moues button is down or up with pyHook. What I currently have is:

def OnDown():
     toggle = True
def OnUp()
     toggle = False

hm = pyHook.HookManager()
hm.HookMouse()
hm.MouseLeftDown = OnDown
hm.MouseLeftUp = OnUp
PumpMessages()
hm.UnhookMouse()

From what I can tell, it registered when my mouse is down but not when I release the button. Any idea as to how I can make it work?

Upvotes: 0

Views: 534

Answers (1)

Max F
Max F

Reputation: 37

Silly me, I just have to return True.

def OnDown(event):
     toggle = "True"
     return True


def OnUp(event):
    toggle = "False"
    return True

Upvotes: 1

Related Questions