📝 Worksheet← Lesson← Course
BitWithBite
Pygame Mastery · Quick Reference

Drawing Graphics Cheat Sheet

Pygame Mastery
In one line: RGB color and every pygame.draw shape function, plus the fill → draw → flip order every frame must follow.

Key Ideas

1RGB Color. Colors are (r,g,b) tuples 0-255. screen.fill(color) clears the frame — must happen before any drawing.
2Lines, Circles, Rects. pygame.draw.line/circle/rect all take (surface, color, position-args, width). width=0 means filled.
3Ellipses. pygame.draw.ellipse fits an oval exactly inside the bounding rect you give it — a square rect makes a circle.
4Polygons. pygame.draw.polygon connects a list of points in order, closing back to the first point automatically.
5Arcs. pygame.draw.arc angles are in radians, measured counter-clockwise from the 3 o'clock position.
6Updating the Screen. Nothing is visible until pygame.display.flip() or .update() runs, once per frame, after all drawing.

Shape Signatures

pygame.draw.line(surf,color,start,end,width)
pygame.draw.circle(surf,color,center,radius,width=0)
pygame.draw.rect(surf,color,rect,width=0,border_radius=0)
pygame.draw.ellipse(surf,color,rect,width=0)
pygame.draw.polygon(surf,color,points,width=0)
pygame.draw.arc(surf,color,rect,start_rad,stop_rad,width=1)
xy(0,0)(240, 70)
Pygame's origin sits at the top-left corner — x grows rightward, y grows downward.