1import pygame
2background_colour = (255,255,255)
3(width, height) = (300, 200)
4screen = pygame.display.set_mode((width, height))
5pygame.display.set_caption('Tutorial 1')
6screen.fill(background_colour)
7pygame.display.flip()
8running = True
9while running:
10 for event in pygame.event.get():
11 if event.type == pygame.QUIT:
12 running = False
1import pygame
2pygame.init()
3dis=pygame.display.set_mode((400,300))
4
5pygame.display.set_caption('Snake game by Pythonist')
6
7blue=(0,0,255)
8red=(255,0,0)
9
10game_over=False
11while not game_over:
12 for event in pygame.event.get():
13 if event.type==pygame.QUIT:
14 game_over=True
15 pygame.draw.rect(dis,blue,[200,150,10,10])
16 pygame.display.update()
17pygame.quit()
18quit()