Guest User

Untitled

a guest
Feb 11th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. #Imports the pygame libary
  2. import pygame
  3.  
  4. #States the pixel locations of the corners (values are actually wrong, i'll fix later)
  5. bottomleft = (0, 0)
  6. bottomright = (0, 639)
  7. topleft = (479, 0)
  8. topright = (639, 479)
  9.  
  10. #Allows the user to state a number between 1-255 to create their own background color
  11. red = input("Input the red color value: ")
  12. green = input("Input the green color value: ")
  13. blue = input("Input the blue color value: ")
  14.  
  15. #Spawns the actual screen itself and running = 1 is basically a placeholder to stop the spam of code
  16. screen = pygame.display.set_mode((640,400))
  17. running = 1
  18.  
  19. #The next 4 lines state that if someone were to hit the X in the top right corner, it will shut the program down
  20. while running:
  21.     event = pygame.event.poll()
  22.     if event.type == pygame.QUIT:
  23.         running = 0
  24. #Draws lines on the screen and colors it, flip just applies it basically        
  25.     screen.fill ((red, green, blue))
  26.     pygame.draw.aaline(screen, (0, 0, 255), bottomleft, topright)
  27.     pygame.draw.aaline(screen, (0, 0, 255), topleft, bottomright)
  28.     pygame.display.flip()
Advertisement
Add Comment
Please, Sign In to add comment