O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

12-1. Blue Sky:

From

Cover of Python Crash Course

Note

import sys import pygame

def run_screen(): pygame.init() screen = pygame.display.set_mode((1200, 800)) pygame.display.set_caption("display blue") screen.fill((0, 220, 0)) image = pygame.image.load('images/ship.bmp')

rect = image.get_rect()
rect.centerx = screen.get_rect().centerx
rect.centery = screen.get_rect().centery
screen.blit(image, rect)

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
    pygame.display.flip()

run_screen()