1 1 # Simple pygame program
2 2
3 3 # Import and initialize the pygame library
4 4 import pygame
5 5 pygame.init()
6 6
7 7 # Set up the drawing window
8 8 screen = pygame.display.set_mode([500, 500])
9 9
1010 # Run until the user asks to quit
1111 running = True
1212 while running:
1313
1414 # Did the user click the window close button?
1515 for event in pygame.event.get():
1616 if event.type == pygame.QUIT:
1717 running = False
1818
1919 # Fill the background with white
2020 screen.fill((255, 255, 255))
2121
2222 # Draw a solid blue circle in the center
2323 pygame.draw.circle(screen, (0, 0, 255), (250, 250), 75)
2424
2525 # Flip the display
2626 pygame.display.flip()
2727
2828 # Done! Time to quit.
2929 pygame.quit()
30
1# Simple pygame code!
2import pygame
3
4pygame.init() # intialize the library
5
6# Set up the drawing window
7screen = pygame.display.set_mode([500, 500])
8
9# Run until the user asks to quit
10running = True
11while running:
12 # Check if the user clicked the close button so that they dont keep playing for like
13 # 2 years
14 for event in pygame.event.get():
15 if event.type == pygame.QUIT:
16 running = False
17
18 # Fill the background with white (R, G, B) (also if you dont like lightmode, just replace it with (0,0,0))
19 screen.fill((255, 255, 255))
20
21 # Draw a blue circle in the center
22 pygame.draw.circle(screen, (0, 0, 255), (250, 250), 75)
23
24 # Flip the display
25 pygame.display.flip()
26
27# Quit the program
28pygame.quit()
1 1# Simple pygame program
2 2
3 3# Import and initialize the pygame library
4 4import pygame
5 5pygame.init()
6 6
7 7# Set up the drawing window
8 8screen = pygame.display.set_mode([500, 500])
9 9
1010# Run until the user asks to quit
1111running = True
1212while running:
1313
1414 # Did the user click the window close button?
1515 for event in pygame.event.get():
1616 if event.type == pygame.QUIT:
1717 running = False
1818
1919 # Fill the background with white
2020 screen.fill((255, 255, 255))
2121
2222 # Draw a solid blue circle in the center
2323 pygame.draw.circle(screen, (0, 0, 255), (250, 250), 75)
2424
2525 # Flip the display
2626 pygame.display.flip()
2727
2828# Done! Time to quit.
2929pygame.quit()
30