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.
I wrote a small program in pygame to do the same.
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()
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 ?