pygame.draw

pygame module for drawing shapes

pygame.draw.rect

draw a rectangle

pygame.draw.polygon

draw a polygon

pygame.draw.circle

describe a circle

pygame.draw.ellipse

draw an ellipse

pygame.draw.arc

draw an elliptical arc

pygame.describe.line

depict a straight line

pygame.draw.lines

describe multiple face-to-face straight line segments

pygame.draw.aaline

depict a straight antialiased line

pygame.draw.aalines

draw multiple face-to-face straight antialiased line segments

Draw several unproblematic shapes to a surface. These functions will work for rendering to any format of surface. Rendering to hardware surfaces volition exist slower than regular software surfaces.

Most of the functions accept a width argument to represent the size of stroke (thickness) around the edge of the shape. If a width of 0 is passed the shape will be filled (solid).

All the cartoon functions respect the prune expanse for the surface and will be constrained to that area. The functions return a rectangle representing the bounding surface area of changed pixels. This bounding rectangle is the 'minimum' bounding box that encloses the afflicted surface area.

All the cartoon functions accept a color argument that tin be one of the following formats:

  • a pygame.Colour pygame object for color representations object

  • an (RGB) triplet (tuple/list)

  • an (RGBA) quadruplet (tuple/list)

  • an integer value that has been mapped to the surface's pixel format (run into pygame.Surface.map_rgb() convert a color into a mapped color value and pygame.Surface.unmap_rgb() convert a mapped integer color value into a Color)

A color's alpha value will exist written directly into the surface (if the surface contains pixel alphas), just the draw function volition not draw transparently.

These functions temporarily lock the surface they are operating on. Many sequential cartoon calls can be sped up by locking and unlocking the surface object around the draw calls (see pygame.Surface.lock() lock the Surface memory for pixel access and pygame.Surface.unlock() unlock the Surface memory from pixel admission).

pygame.describe. rect ( )

draw a rectangle

rect(surface, color, rect) -> Rect

rect(surface, color, rect, width=0, border_radius=0, border_top_left_radius=-one, border_top_right_radius=-i, border_bottom_left_radius=-one, border_bottom_right_radius=-ane) -> Rect

Draws a rectangle on the given surface.

Parameters
  • surface (Surface) -- surface to draw on

  • color (Color or int or tuple ( int , int , int , [ int ] )) -- color to draw with, the blastoff value is optional if using a tuple (RGB[A])

  • rect (Rect) -- rectangle to draw, position and dimensions

  • width (int) --

    (optional) used for line thickness or to betoken that the rectangle is to be filled (not to be confused with the width value of the rect parameter)

    if width == 0 , (default) make full the rectangle

    if width > 0 , used for line thickness

    if width < 0 , nothing will be drawn

    Note

    When using width values > 1 , the edge lines volition abound outside the original boundary of the rect. For more details on how the thickness for edge lines grow, refer to the width notes of the pygame.draw.line() draw a straight line function.

  • border_radius (int) -- (optional) used for drawing rectangle with rounded corners. The supported range is [0, min(height, width) / 2], with 0 representing a rectangle without rounded corners.

  • border_top_left_radius (int) -- (optional) used for setting the value of top left border. If you don't ready this value, it will utilize the border_radius value.

  • border_top_right_radius (int) -- (optional) used for setting the value of top right border. If you don't set this value, information technology volition use the border_radius value.

  • border_bottom_left_radius (int) -- (optional) used for setting the value of lesser left edge. If you don't set this value, information technology will employ the border_radius value.

  • border_bottom_right_radius (int) --

    (optional) used for setting the value of bottom correct edge. If you don't set this value, it will use the border_radius value.

    if border_radius < ane it will describe rectangle without rounded corners

    if any of edge radii has the value < 0 it will utilise value of the border_radius

    If sum of radii on the same side of the rectangle is greater than the rect size the radii

    volition get scaled

Returns

a rect bounding the changed pixels, if nada is fatigued the bounding rect's position will be the position of the given rect parameter and its width and height will be 0

Return type

Rect

Changed in pygame 2.0.0: Added back up for keyword arguments.

Changed in pygame two.0.0.dev8: Added support for border radius.

pygame.depict. polygon ( )

draw a polygon

polygon(surface, color, points) -> Rect

polygon(surface, color, points, width=0) -> Rect

Draws a polygon on the given surface.

Parameters
  • surface (Surface) -- surface to describe on

  • color (Color or int or tuple ( int , int , int , [ int ] )) -- color to draw with, the alpha value is optional if using a tuple (RGB[A])

  • points (tuple ( coordinate ) or list ( coordinate )) -- a sequence of 3 or more (ten, y) coordinates that make up the vertices of the polygon, each coordinate in the sequence must exist a tuple/listing/ pygame.math.Vector2 a 2-Dimensional Vector of 2 ints/floats, e.k. [(x1, y1), (x2, y2), (x3, y3)]

  • width (int) --

    (optional) used for line thickness or to indicate that the polygon is to exist filled

    if width == 0, (default) fill the polygon

    if width > 0, used for line thickness

    if width < 0, nada volition exist drawn

    Note

    When using width values > 1 , the edge lines will grow outside the original boundary of the polygon. For more details on how the thickness for edge lines grow, refer to the width notes of the pygame.draw.line() describe a directly line function.

Returns

a rect bounding the changed pixels, if zero is fatigued the bounding rect's position will be the position of the offset point in the points parameter (bladder values volition be truncated) and its width and height volition be 0

Render type

Rect

Raises
  • ValueError -- if len(points) < 3 (must have at to the lowest degree three points)

  • TypeError -- if points is not a sequence or points does not contain number pairs

Annotation

For an aapolygon, use aalines() with closed=Truthful .

Changed in pygame 2.0.0: Added back up for keyword arguments.

pygame.describe. circle ( )

depict a circle

circle(surface, color, center, radius) -> Rect

circumvolve(surface, colour, center, radius, width=0, draw_top_right=None, draw_top_left=None, draw_bottom_left=None, draw_bottom_right=None) -> Rect

Draws a circumvolve on the given surface.

Parameters
  • surface (Surface) -- surface to draw on

  • color (Colour or int or tuple ( int , int , int , [ int ] )) -- colour to draw with, the alpha value is optional if using a tuple (RGB[A])

  • center (tuple ( int or float , int or float ) or list ( int or bladder , int or bladder ) or Vector2 ( int or bladder , int or float )) -- center indicate of the circle equally a sequence of 2 ints/floats, e.thou. (10, y)

  • radius (int or float) -- radius of the circumvolve, measured from the center parameter, zippo will be drawn if the radius is less than ane

  • width (int) --

    (optional) used for line thickness or to signal that the circumvolve is to exist filled

    if width == 0 , (default) fill up the circle

    if width > 0 , used for line thickness

    if width < 0 , nothing will be drawn

    Note

    When using width values > 1 , the edge lines will only abound inward.

  • draw_top_right (bool) -- (optional) if this is fix to True then the tiptop right corner of the circle will exist drawn

  • draw_top_left (bool) -- (optional) if this is fix to True and then the peak left corner of the circle will be drawn

  • draw_bottom_left (bool) -- (optional) if this is set to True then the lesser left corner of the circle will be drawn

  • draw_bottom_right (bool) --

    (optional) if this is set to Truthful and so the lesser right corner of the circle will be drawn

    if any of the draw_circle_part is Truthful and then it will describe all circle parts that have the True

    value, otherwise information technology will describe the entire circle.

Returns

a rect bounding the changed pixels, if nothing is fatigued the bounding rect's position volition exist the center parameter value (bladder values will be truncated) and its width and height will be 0

Return blazon

Rect

Raises
  • TypeError -- if center is not a sequence of 2 numbers

  • TypeError -- if radius is not a number

Changed in pygame 2.0.0: Added support for keyword arguments. Nothing is fatigued when the radius is 0 (a pixel at the heart coordinates used to be fatigued when the radius equaled 0). Floats, and Vector2 are accustomed for the middle param. The cartoon algorithm was improved to expect more like a circle.

Changed in pygame 2.0.0.dev8: Added support for cartoon circumvolve quadrants.

pygame.depict. ellipse ( )

draw an ellipse

ellipse(surface, color, rect) -> Rect

ellipse(surface, color, rect, width=0) -> Rect

Draws an ellipse on the given surface.

Parameters
  • surface (Surface) -- surface to depict on

  • color (Color or int or tuple ( int , int , int , [ int ] )) -- color to draw with, the alpha value is optional if using a tuple (RGB[A])

  • rect (Rect) -- rectangle to indicate the position and dimensions of the ellipse, the ellipse will be centered within the rectangle and divisional by it

  • width (int) --

    (optional) used for line thickness or to signal that the ellipse is to be filled (not to be confused with the width value of the rect parameter)

    if width == 0 , (default) fill the ellipse

    if width > 0 , used for line thickness

    if width < 0 , nothing will be drawn

    Note

    When using width values > 1 , the edge lines will only abound inward from the original purlieus of the rect parameter.

Returns

a rect bounding the changed pixels, if zip is drawn the bounding rect'due south position will be the position of the given rect parameter and its width and height will exist 0

Render type

Rect

Changed in pygame ii.0.0: Added back up for keyword arguments.

pygame.draw. arc ( )

draw an elliptical arc

arc(surface, color, rect, start_angle, stop_angle) -> Rect

arc(surface, color, rect, start_angle, stop_angle, width=1) -> Rect

Draws an elliptical arc on the given surface.

The two angle arguments are given in radians and point the start and terminate positions of the arc. The arc is drawn in a counterclockwise direction from the start_angle to the stop_angle .

Parameters
  • surface (Surface) -- surface to describe on

  • color (Colour or int or tuple ( int , int , int , [ int ] )) -- color to draw with, the blastoff value is optional if using a tuple (RGB[A])

  • rect (Rect) -- rectangle to bespeak the position and dimensions of the ellipse which the arc volition be based on, the ellipse will exist centered inside the rectangle

  • start_angle (float) -- start bending of the arc in radians

  • stop_angle (float) --

    stop bending of the arc in radians

    if start_angle < stop_angle , the arc is drawn in a counterclockwise direction from the start_angle to the stop_angle

    if start_angle > stop_angle , tau (tau == ii * pi) will be added to the stop_angle , if the resulting stop angle value is greater than the start_angle the higher up start_angle < stop_angle example applies, otherwise cipher will exist fatigued

    if start_angle == stop_angle , nothing will be drawn

  • width (int) --

    (optional) used for line thickness (not to exist dislocated with the width value of the rect parameter)

    if width == 0 , nothing will exist drawn

    if width > 0 , (default is one) used for line thickness

    if width < 0 , aforementioned equally width == 0

    Note

    When using width values > i , the edge lines volition only grow inward from the original boundary of the rect parameter.

Returns

a rect bounding the inverse pixels, if goose egg is drawn the bounding rect's position volition exist the position of the given rect parameter and its width and top will exist 0

Return blazon

Rect

Changed in pygame two.0.0: Added support for keyword arguments.

pygame.draw. line ( )

describe a directly line

line(surface, colour, start_pos, end_pos) -> Rect

line(surface, color, start_pos, end_pos, width=one) -> Rect

Draws a straight line on the given surface. At that place are no endcaps. For thick lines the ends are squared off.

Parameters
  • surface (Surface) -- surface to draw on

  • color (Color or int or tuple ( int , int , int , [ int ] )) -- color to draw with, the alpha value is optional if using a tuple (RGB[A])

  • start_pos (tuple ( int or float , int or bladder ) or list ( int or float , int or bladder ) or Vector2 ( int or bladder , int or float )) -- commencement position of the line, (x, y)

  • end_pos (tuple ( int or bladder , int or bladder ) or list ( int or float , int or float ) or Vector2 ( int or float , int or float )) -- end position of the line, (x, y)

  • width (int) --

    (optional) used for line thickness

    if width >= i, used for line thickness (default is 1)

    if width < 1, nothing volition exist drawn

    Note

    When using width values > 1 , lines will abound as follows.

    For odd width values, the thickness of each line grows with the original line being in the centre.

    For fifty-fifty width values, the thickness of each line grows with the original line being offset from the middle (as in that location is no verbal center line drawn). As a effect, lines with a slope < 1 (horizontal-ish) will have 1 more pixel of thickness below the original line (in the y direction). Lines with a gradient >= ane (vertical-ish) volition have 1 more pixel of thickness to the correct of the original line (in the x direction).

Returns

a rect bounding the changed pixels, if zippo is drawn the bounding rect's position will be the start_pos parameter value (float values volition be truncated) and its width and superlative will exist 0

Return type

Rect

Raises

TypeError -- if start_pos or end_pos is non a sequence of two numbers

Changed in pygame ii.0.0: Added support for keyword arguments.

pygame.draw. lines ( )

depict multiple contiguous straight line segments

lines(surface, color, closed, points) -> Rect

lines(surface, colour, closed, points, width=1) -> Rect

Draws a sequence of face-to-face straight lines on the given surface. There are no endcaps or miter joints. For thick lines the ends are squared off. Drawing thick lines with sharp corners can accept undesired looking results.

Parameters
  • surface (Surface) -- surface to depict on

  • color (Color or int or tuple ( int , int , int , [ int ] )) -- colour to draw with, the alpha value is optional if using a tuple (RGB[A])

  • closed (bool) -- if True an boosted line segment is drawn between the get-go and final points in the points sequence

  • points (tuple ( coordinate ) or list ( coordinate )) -- a sequence of 2 or more (x, y) coordinates, where each coordinate in the sequence must be a tuple/list/ pygame.math.Vector2 a 2-Dimensional Vector of 2 ints/floats and side by side coordinates volition be continued by a line segment, east.yard. for the points [(x1, y1), (x2, y2), (x3, y3)] a line segment volition be fatigued from (x1, y1) to (x2, y2) and from (x2, y2) to (x3, y3) , additionally if the airtight parameter is True some other line segment will be drawn from (x3, y3) to (x1, y1)

  • width (int) --

    (optional) used for line thickness

    if width >= 1, used for line thickness (default is 1)

    if width < one, nothing will exist drawn

    Notation

    When using width values > ane refer to the width notes of line() for details on how thick lines grow.

Returns

a rect bounding the changed pixels, if nothing is fatigued the bounding rect's position volition be the position of the first signal in the points parameter (float values will be truncated) and its width and height will exist 0

Render type

Rect

Raises
  • ValueError -- if len(points) < 2 (must have at least 2 points)

  • TypeError -- if points is non a sequence or points does not contain number pairs

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.draw. aaline ( )

draw a straight antialiased line

aaline(surface, color, start_pos, end_pos) -> Rect

aaline(surface, color, start_pos, end_pos, blend=1) -> Rect

Draws a straight antialiased line on the given surface.

The line has a thickness of one pixel and the endpoints take a height and width of one pixel each.

The way a line and it's endpoints are drawn:

If both endpoints are equal, only a unmarried pixel is drawn (subsequently rounding floats to nearest integer).

Otherwise if the line is non steep (i.e. if the length along the x-axis is greater than the acme along the y-axis):

For each endpoint:

If 10 , the endpoint'south x-coordinate, is a whole number find which pixels would exist covered by information technology and depict them.

Otherwise:

Calculate the position of the nearest point with a whole number for it'southward x-coordinate, when extending the line by the endpoint.

Discover which pixels would exist covered and how much by that betoken.

If the endpoint is the left one, multiply the coverage by (1 - the decimal part of x ).

Otherwise multiply the coverage by the decimal part of 10 .

Then draw those pixels.

east.g.:

The left endpoint of the line ((1, 1.three), (5, iii)) would cover 70% of the pixel (1, 1) and 30% of the pixel (1, ii) while the right one would comprehend 100% of the pixel (5, 3) .

The left endpoint of the line ((one.two, one.4), (4.6, 3.1)) would cover 56% (i.e. 0.viii * seventy%) of the pixel (i, i) and 24% (i.due east. 0.viii * 30%) of the pixel (1, 2) while the right one would cover 42% (i.e. 0.6 * lxx%) of the pixel (v, iii) and xviii% (i.e. 0.6 * xxx%) of the pixel (five, iv) while the correct

And so for each point between the endpoints, forth the line, whose x-coordinate is a whole number:

Observe which pixels would exist covered and how much by that indicate and draw them.

e.m.:

The points forth the line ((i, 1), (iv, 2.five)) would be (two, 1.v) and (3, two) and would cover 50% of the pixel (2, i) , 50% of the pixel (2, 2) and 100% of the pixel (three, 2) .

The points along the line ((1.2, 1.4), (4.half-dozen, 3.1)) would be (two, 1.8) (covering twenty% of the pixel (2, 1) and 80% of the pixel (two, two) ), (three, 2.iii) (covering 70% of the pixel (3, 2) and 30% of the pixel (3, 3) ) and (4, 2.8) (covering 20% of the pixel (2, 1) and 80% of the pixel (2, two) )

Otherwise exercise the same for steep lines equally for non-steep lines except along the y-centrality instead of the x-axis (using y instead of x , top instead of left and bottom instead of right).

Note

Regarding float values for coordinates, a indicate with coordinate consisting of two whole numbers is considered being right in the heart of said pixel (and having a height and width of 1 pixel would therefore completely cover it), while a point with coordinate where ane (or both) of the numbers accept non-goose egg decimal parts would be partially covering ii (or iv if both numbers accept decimal parts) next pixels, eastward.yard. the point (1.4, ii) covers lx% of the pixel (one, 2) and 40% of the pixel (2,2) .

Parameters
  • surface (Surface) -- surface to draw on

  • color (Colour or int or tuple ( int , int , int , [ int ] )) -- color to draw with, the alpha value is optional if using a tuple (RGB[A])

  • start_pos (tuple ( int or float , int or float ) or list ( int or float , int or float ) or Vector2 ( int or float , int or bladder )) -- start position of the line, (x, y)

  • end_pos (tuple ( int or float , int or float ) or list ( int or float , int or float ) or Vector2 ( int or float , int or bladder )) -- end position of the line, (ten, y)

  • blend (int) -- (optional) if non-zero (default) the line volition exist blended with the surface'southward existing pixel shades, otherwise it will overwrite them

Returns

a rect bounding the changed pixels, if null is fatigued the bounding rect'due south position will exist the start_pos parameter value (float values will be truncated) and its width and peak will be 0

Return type

Rect

Raises

TypeError -- if start_pos or end_pos is not a sequence of 2 numbers

Changed in pygame 2.0.0: Added back up for keyword arguments.

pygame.draw. aalines ( )

draw multiple contiguous straight antialiased line segments

aalines(surface, color, closed, points) -> Rect

aalines(surface, color, airtight, points, alloy=1) -> Rect

Draws a sequence of face-to-face straight antialiased lines on the given surface.

Parameters
  • surface (Surface) -- surface to draw on

  • color (Color or int or tuple ( int , int , int , [ int ] )) -- color to draw with, the alpha value is optional if using a tuple (RGB[A])

  • closed (bool) -- if True an additional line segment is drawn between the get-go and last points in the points sequence

  • points (tuple ( coordinate ) or listing ( coordinate )) -- a sequence of 2 or more (ten, y) coordinates, where each coordinate in the sequence must be a tuple/list/ pygame.math.Vector2 a 2-Dimensional Vector of 2 ints/floats and adjacent coordinates will be connected by a line segment, e.g. for the points [(x1, y1), (x2, y2), (x3, y3)] a line segment will be drawn from (x1, y1) to (x2, y2) and from (x2, y2) to (x3, y3) , additionally if the airtight parameter is True another line segment will be drawn from (x3, y3) to (x1, y1)

  • alloy (int) -- (optional) if non-nil (default) each line will be blended with the surface's existing pixel shades, otherwise the pixels will be overwritten

Returns

a rect bounding the changed pixels, if nothing is drawn the bounding rect'southward position volition be the position of the first signal in the points parameter (float values will be truncated) and its width and height volition be 0

Return type

Rect

Raises
  • ValueError -- if len(points) < 2 (must have at least 2 points)

  • TypeError -- if points is not a sequence or points does not comprise number pairs

Changed in pygame two.0.0: Added back up for keyword arguments.

draw module example

Example lawmaking for draw module.

                                    # Import a library of functions chosen 'pygame'                  import                  pygame                  from                  math                  import                  pi                  # Initialize the game engine                  pygame                  .                  init                  ()                  # Define the colors we will use in RGB format                  BLACK                  =                  (                  0                  ,                  0                  ,                  0                  )                  WHITE                  =                  (                  255                  ,                  255                  ,                  255                  )                  BLUE                  =                  (                  0                  ,                  0                  ,                  255                  )                  Greenish                  =                  (                  0                  ,                  255                  ,                  0                  )                  RED                  =                  (                  255                  ,                  0                  ,                  0                  )                  # Set the acme and width of the screen                  size                  =                  [                  400                  ,                  300                  ]                  screen                  =                  pygame                  .                  brandish                  .                  set_mode                  (                  size                  )                  pygame                  .                  display                  .                  set_caption                  (                  "Instance lawmaking for the draw module"                  )                  #Loop until the user clicks the close button.                  done                  =                  Simulated                  clock                  =                  pygame                  .                  time                  .                  Clock                  ()                  while                  not                  done                  :                  # This limits the while loop to a max of x times per second.                  # Leave this out and we will use all CPU we can.                  clock                  .                  tick                  (                  10                  )                  for                  event                  in                  pygame                  .                  event                  .                  get                  ():                  # User did something                  if                  event                  .                  type                  ==                  pygame                  .                  QUIT                  :                  # If user clicked shut                  washed                  =                  True                  # Flag that we are done so we exit this loop                  # All drawing code happens later the for loop and but                  # inside the main while done==False loop.                  # Clear the screen and set the screen background                  screen                  .                  fill                  (                  WHITE                  )                  # Draw on the screen a GREEN line from (0, 0) to (50, 30)                                    # 5 pixels broad.                  pygame                  .                  draw                  .                  line                  (                  screen                  ,                  Green                  ,                  [                  0                  ,                  0                  ],                  [                  50                  ,                  xxx                  ],                  5                  )                  # Describe on the screen 3 BLACK lines, each five pixels wide.                  # The 'False' ways the first and last points are not connected.                  pygame                  .                  draw                  .                  lines                  (                  screen                  ,                  BLACK                  ,                  Imitation                  ,                  [[                  0                  ,                  80                  ],                  [                  50                  ,                  ninety                  ],                  [                  200                  ,                  fourscore                  ],                  [                  220                  ,                  thirty                  ]],                  5                  )                  # Draw on the screen a Green line from (0, 50) to (50, 80)                                    # Because information technology is an antialiased line, it is 1 pixel wide.                  pygame                  .                  describe                  .                  aaline                  (                  screen                  ,                  GREEN                  ,                  [                  0                  ,                  fifty                  ],[                  50                  ,                  80                  ],                  True                  )                  # Depict a rectangle outline                  pygame                  .                  draw                  .                  rect                  (                  screen                  ,                  BLACK                  ,                  [                  75                  ,                  10                  ,                  l                  ,                  xx                  ],                  2                  )                  # Draw a solid rectangle                  pygame                  .                  describe                  .                  rect                  (                  screen                  ,                  BLACK                  ,                  [                  150                  ,                  10                  ,                  fifty                  ,                  xx                  ])                  # Draw a rectangle with rounded corners                  pygame                  .                  describe                  .                  rect                  (                  screen                  ,                  Dark-green                  ,                  [                  115                  ,                  210                  ,                  seventy                  ,                  forty                  ],                  x                  ,                  border_radius                  =                  fifteen                  )                  pygame                  .                  draw                  .                  rect                  (                  screen                  ,                  RED                  ,                  [                  135                  ,                  260                  ,                  50                  ,                  30                  ],                  0                  ,                  border_radius                  =                  10                  ,                  border_top_left_radius                  =                  0                  ,                  border_bottom_right_radius                  =                  15                  )                  # Draw an ellipse outline, using a rectangle as the outside boundaries                  pygame                  .                  draw                  .                  ellipse                  (                  screen                  ,                  Carmine                  ,                  [                  225                  ,                  10                  ,                  50                  ,                  xx                  ],                  2                  )                  # Draw an solid ellipse, using a rectangle every bit the outside boundaries                  pygame                  .                  depict                  .                  ellipse                  (                  screen                  ,                  Carmine                  ,                  [                  300                  ,                  x                  ,                  l                  ,                  xx                  ])                  # This draws a triangle using the polygon command                  pygame                  .                  draw                  .                  polygon                  (                  screen                  ,                  Black                  ,                  [[                  100                  ,                  100                  ],                  [                  0                  ,                  200                  ],                  [                  200                  ,                  200                  ]],                  5                  )                  # Draw an arc every bit function of an ellipse.                                    # Use radians to make up one's mind what angle to depict.                  pygame                  .                  draw                  .                  arc                  (                  screen                  ,                  Black                  ,[                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  0                  ,                  pi                  /                  two                  ,                  2                  )                  pygame                  .                  depict                  .                  arc                  (                  screen                  ,                  GREEN                  ,[                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  pi                  /                  two                  ,                  pi                  ,                  ii                  )                  pygame                  .                  draw                  .                  arc                  (                  screen                  ,                  Bluish                  ,                  [                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  pi                  ,                  3                  *                  pi                  /                  2                  ,                  2                  )                  pygame                  .                  draw                  .                  arc                  (                  screen                  ,                  Reddish                  ,                  [                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  3                  *                  pi                  /                  two                  ,                  two                  *                  pi                  ,                  2                  )                  # Depict a circle                  pygame                  .                  draw                  .                  circumvolve                  (                  screen                  ,                  BLUE                  ,                  [                  60                  ,                  250                  ],                  40                  )                  # Draw just one circle quadrant                  pygame                  .                  draw                  .                  circumvolve                  (                  screen                  ,                  Bluish                  ,                  [                  250                  ,                  250                  ],                  xl                  ,                  0                  ,                  draw_top_right                  =                  True                  )                  pygame                  .                  draw                  .                  circle                  (                  screen                  ,                  Ruddy                  ,                  [                  250                  ,                  250                  ],                  40                  ,                  30                  ,                  draw_top_left                  =                  True                  )                  pygame                  .                  draw                  .                  circle                  (                  screen                  ,                  Green                  ,                  [                  250                  ,                  250                  ],                  40                  ,                  20                  ,                  draw_bottom_left                  =                  Truthful                  )                  pygame                  .                  draw                  .                  circle                  (                  screen                  ,                  BLACK                  ,                  [                  250                  ,                  250                  ],                  40                  ,                  10                  ,                  draw_bottom_right                  =                  True                  )                  # Get ahead and update the screen with what we've drawn.                  # This MUST happen after all the other drawing commands.                  pygame                  .                  display                  .                  flip                  ()                  # Exist IDLE friendly                  pygame                  .                  quit                  ()                

Edit on GitHub