main.py 621 B

123456789101112131415161718192021222324
  1. import pygame
  2. from pygame.locals import *
  3. if __name__ == "__main__":
  4. pygame.init()
  5. surface = pygame.display.set_mode((1000, 500))
  6. surface.fill((255, 255, 255))
  7. block = pygame.image.load("resources/block.jpg").convert()
  8. block_x = 100
  9. block_y = 100
  10. surface.blit(block, (block_x, block_y))
  11. pygame.display.flip()
  12. is_running = True
  13. while is_running:
  14. for event in pygame.event.get():
  15. if event.type == KEYDOWN:
  16. if event.key == K_ESCAPE:
  17. is_running = False
  18. elif event.type == QUIT:
  19. is_running = False