import pygame | |
import sys #will use the exit function | |
#Loads all the main pygame modules and initializes them | |
pygame.init() | |
screen_width=640 | |
screen_height=480 | |
red = (255,0,0) | |
green = (0,255,0) | |
blue = (0,0,255) | |
#Create a new Surface with the dimensions listed above | |
screen=pygame.display.set_mode((screen_width, screen_height)) | |
#Loop forever: | |
while True: | |
#The following makes the window close when clicking the "X" or exit button | |
#Without this, the window will not close, and will need to be killed | |
#with the task manager | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: sys.exit() | |
#(surface, color, center, radius) | |
pygame.draw.circle(screen, blue, (300, 200), 30) | |
#Apply all the changes we've made to the screen surface | |
#And draw them to the screen | |
pygame.display.flip() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment