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

Re: [pygame] Pygame graphics window Freezes



ryan luna wrote:
Yeah, i tried both of those things, neither worked, the second i type in
window = blah blah blah the window comes up its just frozen, when i put the mouse over it, its the hour glass and if i try to do anything like change the name of the window nothing will happen, even if i update.
and when i just run the script by clicking on em, the window closes in a few seconds,

Yes. You updated the window once, but it acts frozen unless it's updated constantly, ie. inside a loop. Try this:


import pygame
from pygame.locals import * ## Definitions of QUIT, key names etc.
pygame.init()
screen = pygame.display.set_mode( (640,480) )

done = False
while not done:
    pygame.display.update()
    for event in pygame.event.get():
        if event.type == QUIT:
            done = True

You should get a continuously-updated screen that vanishes when you hit the window's red X button in the upper-right.

In fact, I've expanded this code into a slightly more complex demo, and uploaded it <a href=http://kschnee.xepher.net/code/pygame-minimal.py.txt>here</a>. This should serve as a bare-bones example. I may upload other tutorial programs.

Kris