pygameDrawing on the screen


Syntax

  • pygame.draw.rect(Surface, color, Rect, width=0)
  • pygame.draw.polygon(Surface, color, pointlist, width=0)
  • pygame.draw.circle(Surface, color, pos, radius, width=0)
  • pygame.draw.ellipse(Surface, color, Rect, width=0)
  • pygame.draw.arc(Surface, color, Rect, start_angle, stop_angle, width=1)
  • pygame.draw.line(Surface, color, start_pos, end_pos, width=1)
  • pygame.draw.lines(Surface, color, closed, pointlist, width=1)
  • pygame.draw.aaline(Surface, color, startpos, endpos, blend=1)
  • pygame.draw.aalines(Surface, color, closed, pointlist, blend=1)

Parameters

ParametersDetails
SurfaceThe Surface to draw the shape on.
colorA 3 or 4 integer sequence representing red, green and blue (and alpha), each value ranging between 0-255.
RectA rectangular area where the shape will be drawn to.
widthThe width of the lines. The shape will be filled if width=0.
pointlistA list of an arbitrary amount of points/vertices, in pixels (x, y).
posThe position of the center of the circle, in pixels (x, y).
radiusThe circles radius in pixels.
closedIf true, a line between last and first point will be drawn, closing the shape.
blend=1If true, the shades will be blended with existing pixel shades instead of overwriting them.
start_angleThe initial angle of the arc, in radians.
stop_angleThe final angle of the arc, in radians.
start_posThe starting position of the line, in pixels.
end_posThe end position of the line, in pixels