27 lines
668 B
Python
27 lines
668 B
Python
|
import pygame
|
||
|
import sys
|
||
|
|
||
|
# Some constants that we use in the program
|
||
|
|
||
|
BACKGROUND_COLOR = (255, 255, 255)
|
||
|
SCREEN_SIZE = (500, 500) # Screen size is 500 x 500
|
||
|
|
||
|
# Start pygame
|
||
|
pygame.init()
|
||
|
window = pygame.display.set_mode(SCREEN_SIZE)
|
||
|
pygame.display.set_caption("Hello world")
|
||
|
|
||
|
# The main loop will run until the QUIT event is triggered
|
||
|
# this event will be triggered by closing the window
|
||
|
while True:
|
||
|
for event in pygame.event.get():
|
||
|
if event.type == pygame.QUIT:
|
||
|
pygame.quit()
|
||
|
sys.exit()
|
||
|
|
||
|
# Fill the screen with the background color and update the screen
|
||
|
window.fill(BACKGROUND_COLOR)
|
||
|
pygame.display.flip()
|
||
|
|
||
|
|