[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] help



srry, just seeing if i have the right address,
so im using python 2.6 and pygame 1.8

When i write out a script and save it, I run it, and all is fine
until i try to close the window, and it freezes and goes to an
unresponsive program, then IDLE tells me this
 
Traceback (most recent call last):
  File "C:\Python26\RectTest.py", line 15, in <module>
    exit()
SystemExit
On Thu, Oct 30, 2008 at 1:36 PM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
You'll have to be more specific.

import pygame
from pygame.locals import *
from sys import exit

from random import *

pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)


while True:

    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
             
    screen.lock()
 
    for count in range(10):
        random_color = (randint(0,255), randint(0,255), randint(0,255))
        random_pos = (randint(0,639), randint(0,479))
        random_size = (639-randint(random_pos[0],639), 479-randint (random_pos[1],479))
        
        pygame.draw.rect(screen, random_color, Rect(random_pos, random_size))
    screen.unlock()

    pygame.display.update()