Saltar a contenido

Dibujando en la superficie

import sys
import pygame as pg

WIDTH, HEIGHT = 720, 400
BACKGROUND = (13, 17, 23)

pg.init()
display = pg.display.set_mode((WIDTH, HEIGHT))
display.fill(BACKGROUND)

pg.draw.line(display, (255, 0, 0), (50, 50), (150, 150), 3)
pg.draw.rect(display, (0, 255, 255), (550, 50, 100, 100))
pg.draw.circle(display, (255, 255, 255), (400, 250), 100, 10)
pg.draw.ellipse(display, (0, 255, 0), (75, 225, 150, 100))

while 1:
    for event in pg.event.get():
        if event.type == pg.QUIT:
            sys.exit()

    pg.display.update()

Última edición: 13 de Febrero de 2022