Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys, pygame
- # --- Инициализация
- pygame.init()
- WIDTH, HEIGHT = 640, 360
- screen = pygame.display.set_mode((WIDTH, HEIGHT))
- pygame.display.set_caption("01 — Hello, Pygame")
- clock = pygame.time.Clock()
- font = pygame.font.SysFont(None, 48)
- # --- Главный цикл
- running = True
- while running:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- pygame.quit()
- sys.exit()
- # Отрисовка
- screen.fill((30, 30, 40)) # фон
- text = font.render("Hello, Pygame!", True, (240, 240, 255))
- screen.blit(text, (20, 20))
- pygame.display.flip()
- clock.tick(60) # 60 FPS
Advertisement
Add Comment
Please, Sign In to add comment