# HG changeset patch # User Radomir Dopieralski # Date 1339687167 -7200 # Node ID ee28ba29d97ee2655d3941d78fb2527769e2e175 # Parent ae5f8de62b25f8dd041d99c13306dcca27c7980f Some tweak in the basic pygame program diff -r ae5f8de62b25 -r ee28ba29d97e .hgignore --- a/.hgignore Thu Jun 14 12:48:47 2012 +0200 +++ b/.hgignore Thu Jun 14 17:19:27 2012 +0200 @@ -7,6 +7,7 @@ bin/ lib/ include/ +share/ local *.egg-info *.DS_Store diff -r ae5f8de62b25 -r ee28ba29d97e 000/002.py --- a/000/002.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/002.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,7 +12,6 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): @@ -21,6 +20,7 @@ def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT: diff -r ae5f8de62b25 -r ee28ba29d97e 000/003.py --- a/000/003.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/003.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,18 +12,17 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): """Load the image and display it in the middle of the screen.""" image = pygame.image.load('cup.png') screen.blit(image, (0, 0)) - pygame.display.update() def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT: diff -r ae5f8de62b25 -r ee28ba29d97e 000/004.py --- a/000/004.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/004.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,7 +12,6 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): @@ -27,11 +26,11 @@ (screen_rect.height - image_rect.height) // 2, ) ) - pygame.display.update() def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT: diff -r ae5f8de62b25 -r ee28ba29d97e 000/005.py --- a/000/005.py Thu Jun 14 12:48:47 2012 +0200 +++ b/000/005.py Thu Jun 14 17:19:27 2012 +0200 @@ -12,7 +12,6 @@ pygame.display.init() screen = pygame.display.set_mode((800, 600)) screen.fill((0x66, 0x66, 0x66)) - pygame.display.update() return screen def load_and_display_image(screen): @@ -22,16 +21,13 @@ image.set_colorkey((0xff, 0x00, 0xff)) screen_rect = screen.get_rect() image_rect = image.get_rect() - screen.blit(image, ( - (screen_rect.width - image_rect.width) // 2, - (screen_rect.height - image_rect.height) // 2, - ) - ) - pygame.display.update() + image_rect.center = screen_rect.center + screen.blit(image, image_rect) def wait_for_quit(): """Sit there doing nothing until the window is closed.""" clock = pygame.time.Clock() + pygame.display.update() while True: event = pygame.event.wait() if event.type == pg.QUIT: