ateyevtm

Untitled

Oct 1st, 2025
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. import sys, pygame
  2.  
  3. # --- Инициализация
  4. pygame.init()
  5. WIDTH, HEIGHT = 640, 360
  6. screen = pygame.display.set_mode((WIDTH, HEIGHT))
  7. pygame.display.set_caption("01 — Hello, Pygame")
  8. clock = pygame.time.Clock()
  9. font = pygame.font.SysFont(None, 48)
  10.  
  11. # --- Главный цикл
  12. running = True
  13. while running:
  14.     for event in pygame.event.get():
  15.         if event.type == pygame.QUIT:
  16.             pygame.quit()
  17.             sys.exit()
  18.  
  19.  
  20.     # Отрисовка
  21.     screen.fill((30, 30, 40))  # фон
  22.     text = font.render("Hello, Pygame!", True, (240, 240, 255))
  23.     screen.blit(text, (20, 20))
  24.  
  25.     pygame.display.flip()
  26.     clock.tick(60)  # 60 FPS
  27.  
Advertisement
Add Comment
Please, Sign In to add comment