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

Re: [pygame] movie



Although others have answered this question:

In general terms, what you probably want to do is to have a loop like this:

CreateScreenSaverObjects()

done = False
while not done:

    for event in pygame.event.get():
        ## Handle events, setting "done" to True if Esc is pressed.

    CalculateWhereObjectsShouldBeDrawn()
    ClearTheScreen()
    DrawStuffToScreen()
    pygame.display.update()
    time.sleep(.1) ## Must "import time" for this; creates optional delay

## End of code.

In other words, you need to figure out how each frame of the screen
saver should be drawn, and loop through the process of figuring out what
to draw, then drawing it. Pretty much any Python/Pygame app is going to
have a vaguely similar control loop, I think.

Kris