Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Imports the pygame libary
- import pygame
- #States the pixel locations of the corners (values are actually wrong, i'll fix later)
- bottomleft = (0, 0)
- bottomright = (0, 639)
- topleft = (479, 0)
- topright = (639, 479)
- #Allows the user to state a number between 1-255 to create their own background color
- red = input("Input the red color value: ")
- green = input("Input the green color value: ")
- blue = input("Input the blue color value: ")
- #Spawns the actual screen itself and running = 1 is basically a placeholder to stop the spam of code
- screen = pygame.display.set_mode((640,400))
- running = 1
- #The next 4 lines state that if someone were to hit the X in the top right corner, it will shut the program down
- while running:
- event = pygame.event.poll()
- if event.type == pygame.QUIT:
- running = 0
- #Draws lines on the screen and colors it, flip just applies it basically
- screen.fill ((red, green, blue))
- pygame.draw.aaline(screen, (0, 0, 255), bottomleft, topright)
- pygame.draw.aaline(screen, (0, 0, 255), topleft, bottomright)
- pygame.display.flip()
Advertisement
Add Comment
Please, Sign In to add comment