Yes, look at the following example:
import pygame import threading import Queue pygame.init() screen = pygame.display.set_mode((300, 300)) quit_game = False commands = Queue.Queue() pos = 10, 10 m = {'w': (0, -10), 'a': (-10, 0), 's': (0, 10), 'd': (10, 0)} class Input(threading.Thread): def run(self): while not quit_game: command = raw_input() commands.put(command) i = Input() i.start() old_pos = [] while not quit_game: try: command = commands.get(False) except Queue.Empty: command = None if command in m: old_pos.append(pos) pos = map(sum, zip(pos, m[command])) if pygame.event.get(pygame.QUIT): print "press enter to exit" quit_game = True pygame.event.poll() screen.fill((0, 0, 0)) for p in old_pos: pygame.draw.circle(screen, (50, 0, 0), p, 10, 2) pygame.draw.circle(screen, (200, 0, 0), pos, 10, 2) pygame.display.flip() i.join()
Creates a small red circle. You can move it using the input w , a , s or d in the console.

sloth source share