La manera mas facil que conozco es usando pygame:
http://www.pygame.org/
Y mas concretamente (uh, te la hice refacil) :) aca tenes el source code:
http://lorenzod8n.wordpress.com/2007...rial-5-pixels/
Posteo el codigo por si el blog desaparece (cut & paste):
Código python:
Ver original1 #! /usr/bin/env python
2
3 # Plot random pixels on the screen.
4
5 import pygame
6 import random
7
8 # Window dimensions
9 width = 640
10 height = 400
11
12 screen = pygame.display.set_mode((width, height))
13 clock = pygame.time.Clock()
14 running = True
15
16 while running:
17 x = random.randint(0, width-1)
18 y = random.randint(0, height-1)
19 red = random.randint(0, 255)
20 green = random.randint(0, 255)
21 blue = random.randint(0, 255)
22
23 screen.set_at((x, y), (red, green, blue))
24
25 for event in pygame.event.get():
26 if event.type == pygame.QUIT:
27 running = False
28
29 pygame.display.flip()
30 clock.tick(240)