import sys import win32api, win32con import pyHook import pythoncom def CursorLeft(): win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, -1, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0) def Quit(): print "Quitting" sys.exit()
The CursorLeft function works great every time. It also works great without any negative numbers as parameters. I completely lost why this is happening!
First call, great.
Second challenge
TypeError: integer required
Third call, fine.
Fourth call
TypeError: integer required.
so on and so forth
solvable
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, -1, 0, 0, 0)
The last two parameters passed allow the function to function correctly. I'm still not sure why and would still like to know , but at least now it works . Strike>
solvable
return True
It is very important that event functions return true.
source share