Mercurial > pygame-tutorial
view 000/001.py @ 12:9dc97f88e274 default tip
Added CC0 license
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Sun, 08 Jul 2012 19:56:38 +0200 |
| parents | ae5f8de62b25 |
| children |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- import pygame import pygame.locals as pg def initialize_screen(): """Initialize pygame, create a window and fill it with gray. Return the screen surface. """ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) return screen def load_and_display_image(screen): """Load the image and display it in the middle of the screen.""" def wait_for_quit(): """Sit there doing nothing until the window is closed.""" while True: event = pygame.event.wait() if event.type == pg.QUIT: return if __name__ == '__main__': screen = initialize_screen() load_and_display_image(screen) wait_for_quit()
