@mvidberg/

PygameTest

Pygame

No description

fork
loading
Files
  • main.py
  • nohup.out
  • test.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Sample Python/Pygame Programs 
# Simpson College Computer Science 
# http://cs.simpson.edu 
  
# Import a library of functions called 'pygame' 
import pygame
  
# Initialize the game engine 
pygame.init() 
  
# Define the colors we will use in RGB format 
black = [  0,  0,  0] 
white = [255,255,255] 
blue =  [  0,  0,255] 
green = [  0,255,  0] 
red =   [255,  0,  0]
yellow = [255,255,0]
  
pi=3.141592653
  
# Set the height and width of the screen 
size=[500,500] 
screen=pygame.display.set_mode(size) 
  
pygame.display.set_caption("Professor Craven's Cool Game") 
  
#Loop until the user clicks the close button. 
done=False
clock = pygame.time.Clock() 
  
while done==False: 
  
    # This limits the while loop to a max of 10 times per second. 
    # Leave this out and we will use all CPU we can. 
    clock.tick(10) 
      
    for event in pygame.event.get(): # User did something 
        if event.type == pygame.QUIT: # If user clicked close 
            done=True # Flag that we are done so we exit this loop 
  
    # All drawing code happens after the for loop and but 
    # inside the main while done==False loop. 
      
    # Clear the screen and set the screen background 
    screen.fill(white) 
  
   
      
    # Draw an ellipse, using a rectangle as the outside boundaries 
    pygame.draw.ellipse(screen,blue,[0,0,500,500],0)
    pygame.draw.ellipse(screen, red, [100,100,300,300],0)
    pygame.draw.ellipse(screen, yellow, [200,200,100,100],0)
      # Go ahead and update the screen with what we've drawn. 
    # This MUST happen after all the other drawing commands. 
    pygame.display.flip() 
  
# Be IDLE friendly 
pygame.quit ()