RootOfTheNull

Python [pygame] 18 The draw Module

Mar 8th, 2014
124
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3. import pygame
  4.  
  5. if ( __name__ == "__main__" ):
  6.  
  7.     pygame.init()
  8.  
  9.     size = width, height = 400, 200
  10.     window = pygame.display.set_mode( size )
  11.  
  12.     white = pygame.Color( 255, 255, 255 )
  13.     red = pygame.Color( 255, 0, 0 )
  14.  
  15.     window.fill( white )
  16.  
  17.     #rect = pygame.Rect( (20, 50), ( 100, 120 ) )
  18.     #pygame.draw.rect( window, red, rect, 3 )
  19.  
  20.  
  21.     #points_list = [ (20, 50), ( 3, 120 ), ( 100, 120 ), ( 150, 90 ), ( 80, 30 ), ]
  22.     #pygame.draw.polygon( window, red, points_list )
  23.  
  24.     #pygame.draw.circle( window, red, ( width/2, height/2 ), 70, 1 )
  25.  
  26.     #pygame.draw.line( window, red, ( 20, 180 ), ( 350, 40 ), 5 )
  27.    
  28.  
  29.     pygame.display.update(  )
  30.  
  31.     running = True
  32.     while ( running ):
  33.         for event in pygame.event.get():
  34.             if ( event.type == pygame.QUIT ) or ( event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE ):
  35.                 running = False
  36.  
  37.  
  38.     pygame.quit()
RAW Paste Data