title: Mouse motion tracking Program with python
body: <p>I am trying to track mouse motion on a variety of applications, like the desktop, or some web applications. This is to understand and capture user behaviour (those users who are computer illiterate, trying to understand how they behave and interact with the system). For example, if I make such a user sit in front of a desktop and leave him, my program should track all the movements which he makes with the mouse, which I can later correspond with the design of the system.</p>
  
  <p>I wrote a small program in pygame to do the same.</p>
  
  <pre><code>import pygame
  
  x = y = 0
  running = 1
  screen = pygame.display.set_mode((640, 400))
  
  while running:
      event = pygame.event.poll()
      if event.type == pygame.QUIT:
          running = 0
      elif event.type == pygame.MOUSEMOTION:
          print "mouse at (%d, %d)" % event.pos
  
      screen.fill((0, 0, 0))
      pygame.display.flip()
  </code></pre>
  
  <p>I wish to change the "screen = pygame.display.set_mode((640, 400))". I dont want a new window to be opened by pygame. I want the same window I am working upon, and it tracks the mouse movements. Even if I close my editor, the program should run. There should be no seperate screen. How do I do it ?</p>