Pygame tutorial n. 1

Let’s start a serie of tutorial about Pygame. Ready? Go!

In this first part we will show:

The code of Pygame tutorial 1 – window and surfaces

import pygame


pygame.init()

screen = pygame.display.set_mode((400, 600))
square = pygame.Surface((20, 20))
square.fill((255, 0, 0))
while True:
    screen.blit(square, (100, 100))
    if pygame.event.get(pygame.QUIT):
        break
    pygame.display.update()

pygame.quit()


Subscribe to the newsletter for updates
Tkinter templates
My youtube channel

Twitter: @pythonprogrammi - python_pygame

Videos

Speech recognition game

Pygame's Platform Game

Other Pygame's posts