figured out how to draw a rectangle

This commit is contained in:
milanjaeckel 2026-05-10 09:43:55 +02:00
parent 518e5502f4
commit 7bb88ebd07
2 changed files with 6 additions and 7 deletions

10
main.py
View File

@ -2,14 +2,12 @@ import pygame as pg
#start pygame
pg.init()
screen = pg.display.set_mode((800, 600))
screen = pg.display.set_mode((800, 800)) #window (size)
clock = pg.time.Clock()
running = True
color = (0, 0, 0) #rectangle color
while running:
lead_x = 20
lead_y = 20
while running: #open window
for event in pg.event.get():
if event.type == pg.QUIT:
@ -19,7 +17,7 @@ while running:
screen.fill("white")
#chess game
pg.draw.rect()
pg.draw.rect(screen, color, pg.Rect(0, 0, 100, 100))
#flip display to put game on screen

View File

@ -2,3 +2,4 @@
---SOURCES---
https://www.pygame.org/docs/tut/ImportInit.html
https://www.geeksforgeeks.org/python/how-to-draw-rectangle-in-pygame/