graphing.py 743 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import pygame
  2. import sys
  3. # Initialize Pygame
  4. pygame.init()
  5. # Set up the display
  6. width, height = 800, 600
  7. screen = pygame.display.set_mode((width, height))
  8. pygame.display.set_caption("Draw a Circle")
  9. # Define colors
  10. WHITE = (255, 255, 255)
  11. BLUE = (0, 102, 255)
  12. # Circle parameters
  13. circle_center = (width // 2, height // 2)
  14. circle_radius = 75
  15. # Main loop
  16. running = True
  17. while running:
  18. # Handle events
  19. for event in pygame.event.get():
  20. if event.type == pygame.QUIT:
  21. running = False
  22. # Fill the background
  23. screen.fill(WHITE)
  24. # Draw the circle
  25. pygame.draw.circle(screen, BLUE, circle_center, circle_radius)
  26. # Update the display
  27. pygame.display.flip()
  28. # Quit Pygame
  29. pygame.quit()
  30. sys.exit()