title: Using pyHook to get mouse coordinates to play back later
body: <p>I am writing a chunk of code to get gather mouse click information using pyHook and then the win32api to get access to a click function. Essentially I am trying to use the mouse to record a pattern of clicks to be recorded and played back later.</p>
  
  <p>Here is my present code: </p>
  
  <pre><code>import win32api, win32con, time, win32ui, pyHook, pythoncom
  
  #Define the clicks in the win32api
  def click(x,y):
      win32api.SetCursorPos((x,y))
      win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
      win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
  
  def onclick(event):
      click()
      print event.Position
      return True
  
  hm = pyHook.HookManager()
  hm.SubscribeMouseAllButtonsDown(click)
  hm.HookMouse()
  pythoncom.PumpMessages()
  hm.UnhookMouse()
  </code></pre>
  
  <p>I am sure there is something stupidly simple. </p>
  
  <p>Also here is the debug I got from running this:</p>
  
  <pre><code>Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pyHook\HookManager.py", line 325, in MouseSwitch
  return func(event)
  TypeError: click() takes exactly 2 arguments (1 given)
  </code></pre>