pygame.depict

pygame module for drawing shapes

pygame.draw.rect

depict a rectangle

pygame.draw.polygon

describe a polygon

pygame.draw.circle

draw a circle

pygame.draw.ellipse

describe an ellipse

pygame.draw.arc

describe an elliptical arc

pygame.depict.line

draw a straight line

pygame.draw.lines

draw multiple contiguous directly line segments

pygame.describe.aaline

draw a direct antialiased line

pygame.draw.aalines

draw multiple contiguous straight antialiased line segments

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

Nearly of the functions take a width statement to correspond the size of stroke (thickness) effectually the edge of the shape. If a width of 0 is passed the shape will be filled (solid).

All the drawing functions respect the clip area for the surface and volition be constrained to that area. The functions return a rectangle representing the bounding area of changed pixels. This bounding rectangle is the 'minimum' bounding box that encloses the affected area.

All the drawing functions accept a color argument that can be one of the following formats:

  • a pygame.Color pygame object for color representations object

  • an (RGB) triplet (tuple/list)

  • an (RGBA) quadruplet (tuple/listing)

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

A color's alpha value volition be written directly into the surface (if the surface contains pixel alphas), but the draw role will non draw transparently.

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

pygame.draw. rect ( )

draw a rectangle

rect(surface, color, rect) -> Rect

rect(surface, colour, rect, width=0, border_radius=0, border_top_left_radius=-1, border_top_right_radius=-1, border_bottom_left_radius=-i, border_bottom_right_radius=-1) -> Rect

Draws a rectangle on the given surface.

Parameters
  • surface (Surface) -- surface to describe 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])

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

  • width (int) --

    (optional) used for line thickness or to indicate that the rectangle is to exist filled (non to be dislocated with the width value of the rect parameter)

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

    if width > 0 , used for line thickness

    if width < 0 , zero will exist drawn

    Note

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

  • border_radius (int) -- (optional) used for cartoon rectangle with rounded corners. The supported range is [0, min(pinnacle, 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 use the border_radius value.

  • border_top_right_radius (int) -- (optional) used for setting the value of acme correct border. If yous don't ready this value, it will use the border_radius value.

  • border_bottom_left_radius (int) -- (optional) used for setting the value of bottom left border. If you don't ready this value, it volition use the border_radius value.

  • border_bottom_right_radius (int) --

    (optional) used for setting the value of lesser right border. If you don't gear up this value, it volition employ the border_radius value.

    if border_radius < ane information technology will draw rectangle without rounded corners

    if any of border radii has the value < 0 it will apply value of the border_radius

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

    will get scaled

Returns

a rect bounding the changed pixels, if nothing 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

Return type

Rect

Inverse in pygame 2.0.0: Added support for keyword arguments.

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

pygame.draw. 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 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])

  • points (tuple ( coordinate ) or list ( coordinate )) -- a sequence of 3 or more (x, y) coordinates that make upwardly the vertices of the polygon, each coordinate in the sequence must be a tuple/list/ pygame.math.Vector2 a 2-Dimensional Vector of two ints/floats, due east.yard. [(x1, y1), (x2, y2), (x3, y3)]

  • width (int) --

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

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

    if width > 0, used for line thickness

    if width < 0, nothing will be 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 abound, refer to the width notes of the pygame.draw.line() draw a direct line role.

Returns

a rect bounding the changed pixels, if nothing is fatigued the bounding rect'south position will be the position of the kickoff point in the points parameter (bladder values volition be truncated) and its width and acme will exist 0

Render type

Rect

Raises
  • ValueError -- if len(points) < 3 (must have at least 3 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.draw. circle ( )

draw a circle

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

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

Draws a circle on the given surface.

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

  • color (Colour or int or tuple ( int , int , int , [ int ] )) -- color to depict 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 float ) or Vector2 ( int or bladder , int or float )) -- center point of the circle as a sequence of 2 ints/floats, e.m. (x, y)

  • radius (int or bladder) -- radius of the circle, measured from the center parameter, nothing will be drawn if the radius is less than 1

  • width (int) --

    (optional) used for line thickness or to indicate that the circle is to be filled

    if width == 0 , (default) make full 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 simply grow inward.

  • draw_top_right (bool) -- (optional) if this is set to Truthful then the height right corner of the circumvolve will exist drawn

  • draw_top_left (bool) -- (optional) if this is set to Truthful and so the peak left corner of the circle will be drawn

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

  • draw_bottom_right (bool) --

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

    if whatever of the draw_circle_part is Truthful so it will draw all circle parts that have the True

    value, otherwise it will draw the entire circle.

Returns

a rect bounding the inverse pixels, if zero is fatigued the bounding rect'due south position will be the middle parameter value (float values will be truncated) and its width and height will be 0

Return type

Rect

Raises
  • TypeError -- if eye is not a sequence of two numbers

  • TypeError -- if radius is not a number

Changed in pygame ii.0.0: Added support for keyword arguments. Nothing is fatigued when the radius is 0 (a pixel at the center coordinates used to be drawn when the radius equaled 0). Floats, and Vector2 are accepted for the center param. The drawing algorithm was improved to wait more than like a circle.

Inverse in pygame 2.0.0.dev8: Added support for drawing circle quadrants.

pygame.draw. ellipse ( )

depict 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 draw on

  • colour (Colour 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 signal the position and dimensions of the ellipse, the ellipse will be centered inside the rectangle and bounded by information technology

  • width (int) --

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

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

    if width > 0 , used for line thickness

    if width < 0 , nothing will exist drawn

    Note

    When using width values > ane , the edge lines will simply abound in from the original boundary of the rect parameter.

Returns

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

Return type

Rect

Changed in pygame two.0.0: Added support 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 2 angle arguments are given in radians and betoken the offset and terminate positions of the arc. The arc is drawn in a counterclockwise management from the start_angle to the stop_angle .

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

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

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

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

  • stop_angle (float) --

    stop angle 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 == 2 * pi) will exist added to the stop_angle , if the resulting cease angle value is greater than the start_angle the higher up start_angle < stop_angle case applies, otherwise zilch will exist fatigued

    if start_angle == stop_angle , null will be drawn

  • width (int) --

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

    if width == 0 , nothing will be drawn

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

    if width < 0 , same every bit width == 0

    Note

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

Returns

a rect bounding the changed pixels, if goose egg is drawn the bounding rect's position will be the position of the given rect parameter and its width and pinnacle will be 0

Return type

Rect

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

pygame.draw. line ( )

draw a direct line

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

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

Draws a direct line on the given surface. There are no endcaps. For thick lines the ends are squared off.

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

  • colour (Colour or int or tuple ( int , int , int , [ int ] )) -- color to describe with, the blastoff 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 bladder ) or Vector2 ( int or float , int or float )) -- start position of the line, (x, y)

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

  • width (int) --

    (optional) used for line thickness

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

    if width < 1, nothing will be fatigued

    Note

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

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

    For even width values, the thickness of each line grows with the original line being outset from the center (every bit at that place is no exact center line drawn). As a result, lines with a slope < 1 (horizontal-ish) volition have i more pixel of thickness below the original line (in the y direction). Lines with a slope >= 1 (vertical-ish) will 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 nothing is drawn the bounding rect'south position will be the start_pos parameter value (float values will be truncated) and its width and height will be 0

Render blazon

Rect

Raises

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

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.draw. lines ( )

draw 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 precipitous corners tin can have undesired looking results.

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

  • colour (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 betwixt the get-go and last 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 exist a tuple/list/ pygame.math.Vector2 a ii-Dimensional Vector of 2 ints/floats and side by side coordinates will be connected past 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 closed 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 >= ane, used for line thickness (default is ane)

    if width < 1, cipher volition be drawn

    Note

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

Returns

a rect bounding the changed pixels, if nothing is drawn the bounding rect's position volition be the position of the first betoken in the points parameter (float values will be truncated) and its width and superlative 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 contain number pairs

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

pygame.depict. aaline ( )

draw a straight antialiased line

aaline(surface, colour, 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 have a height and width of 1 pixel each.

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

If both endpoints are equal, simply a single pixel is fatigued (after rounding floats to nearest integer).

Otherwise if the line is not steep (i.eastward. if the length along the ten-axis is greater than the height forth the y-centrality):

For each endpoint:

If x , the endpoint's 10-coordinate, is a whole number notice which pixels would be covered past information technology and draw them.

Otherwise:

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

Find which pixels would exist covered and how much by that point.

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

Otherwise multiply the coverage by the decimal role of 10 .

And then draw those pixels.

e.k.:

The left endpoint of the line ((ane, 1.3), (five, 3)) would comprehend 70% of the pixel (1, 1) and 30% of the pixel (1, ii) while the right one would cover 100% of the pixel (v, 3) .

The left endpoint of the line ((1.2, 1.four), (4.6, iii.one)) would cover 56% (i.e. 0.eight * lxx%) of the pixel (ane, 1) and 24% (i.e. 0.viii * xxx%) of the pixel (1, 2) while the right 1 would cover 42% (i.e. 0.half dozen * 70%) of the pixel (five, three) and 18% (i.e. 0.half dozen * 30%) of the pixel (5, four) while the right

Then for each betoken between the endpoints, along the line, whose ten-coordinate is a whole number:

Find which pixels would be covered and how much past that point and draw them.

due east.one thousand.:

The points along the line ((one, 1), (4, 2.5)) would be (ii, 1.5) and (iii, 2) and would cover 50% of the pixel (2, 1) , 50% of the pixel (2, two) and 100% of the pixel (three, two) .

The points along the line ((ane.ii, 1.4), (four.6, 3.1)) would be (2, 1.8) (covering twenty% of the pixel (2, 1) and 80% of the pixel (2, 2) ), (3, ii.iii) (covering seventy% of the pixel (three, 2) and 30% of the pixel (iii, three) ) and (4, 2.viii) (roofing twenty% of the pixel (2, one) and 80% of the pixel (ii, two) )

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

Note

Regarding float values for coordinates, a bespeak with coordinate consisting of ii whole numbers is considered being right in the middle of said pixel (and having a height and width of 1 pixel would therefore completely cover it), while a point with coordinate where one (or both) of the numbers accept not-zilch decimal parts would be partially roofing two (or 4 if both numbers take decimal parts) adjacent pixels, eastward.g. the indicate (1.4, 2) covers threescore% of the pixel (1, 2) and 40% of the pixel (2,2) .

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

  • color (Color or int or tuple ( int , int , int , [ int ] )) -- color to depict 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 float )) -- offset position of the line, (x, y)

  • end_pos (tuple ( int or bladder , int or bladder ) or listing ( int or bladder , int or float ) or Vector2 ( int or float , int or bladder )) -- finish position of the line, (10, y)

  • alloy (int) -- (optional) if not-aught (default) the line will exist blended with the surface's existing pixel shades, otherwise information technology will overwrite them

Returns

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

Return blazon

Rect

Raises

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

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.describe. aalines ( )

draw multiple contiguous straight antialiased line segments

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

aalines(surface, color, closed, points, blend=1) -> Rect

Draws a sequence of contiguous direct 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 blastoff value is optional if using a tuple (RGB[A])

  • closed (bool) -- if True an additional line segment is fatigued between the first and terminal points in the points sequence

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

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

Returns

a rect bounding the inverse pixels, if nothing is drawn the bounding rect'south position will exist the position of the first betoken in the points parameter (float values will be truncated) and its width and summit volition be 0

Render type

Rect

Raises
  • ValueError -- if len(points) < 2 (must have at least two 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.

draw module example

Example code for depict module.

                                    # Import a library of functions called 'pygame'                  import                  pygame                  from                  math                  import                  pi                  # Initialize the game engine                  pygame                  .                  init                  ()                  # Define the colors nosotros will utilize in RGB format                  Black                  =                  (                  0                  ,                  0                  ,                  0                  )                  WHITE                  =                  (                  255                  ,                  255                  ,                  255                  )                  Blue                  =                  (                  0                  ,                  0                  ,                  255                  )                  GREEN                  =                  (                  0                  ,                  255                  ,                  0                  )                  RED                  =                  (                  255                  ,                  0                  ,                  0                  )                  # Set the meridian and width of the screen                  size                  =                  [                  400                  ,                  300                  ]                  screen                  =                  pygame                  .                  display                  .                  set_mode                  (                  size                  )                  pygame                  .                  display                  .                  set_caption                  (                  "Instance code for the draw module"                  )                  #Loop until the user clicks the close push.                  washed                  =                  False                  clock                  =                  pygame                  .                  fourth dimension                  .                  Clock                  ()                  while                  not                  done                  :                  # This limits the while loop to a max of 10 times per second.                  # Go out this out and we will use all CPU nosotros can.                  clock                  .                  tick                  (                  x                  )                  for                  event                  in                  pygame                  .                  effect                  .                  become                  ():                  # User did something                  if                  consequence                  .                  type                  ==                  pygame                  .                  QUIT                  :                  # If user clicked shut                  washed                  =                  True                  # Flag that we are done so we exit this loop                  # All cartoon code happens afterwards the for loop and but                  # within the main while done==Imitation loop.                  # Articulate the screen and set the screen background                  screen                  .                  fill                  (                  WHITE                  )                  # Draw on the screen a Greenish line from (0, 0) to (l, 30)                                    # five pixels broad.                  pygame                  .                  draw                  .                  line                  (                  screen                  ,                  GREEN                  ,                  [                  0                  ,                  0                  ],                  [                  fifty                  ,                  30                  ],                  5                  )                  # Draw on the screen 3 Blackness lines, each 5 pixels wide.                  # The 'False' ways the first and terminal points are non connected.                  pygame                  .                  draw                  .                  lines                  (                  screen                  ,                  Black                  ,                  False                  ,                  [[                  0                  ,                  eighty                  ],                  [                  50                  ,                  90                  ],                  [                  200                  ,                  80                  ],                  [                  220                  ,                  30                  ]],                  five                  )                  # Draw on the screen a GREEN line from (0, 50) to (50, 80)                                    # Considering it is an antialiased line, it is 1 pixel broad.                  pygame                  .                  depict                  .                  aaline                  (                  screen                  ,                  GREEN                  ,                  [                  0                  ,                  50                  ],[                  l                  ,                  80                  ],                  Truthful                  )                  # Draw a rectangle outline                  pygame                  .                  draw                  .                  rect                  (                  screen                  ,                  BLACK                  ,                  [                  75                  ,                  ten                  ,                  50                  ,                  20                  ],                  two                  )                  # Describe a solid rectangle                  pygame                  .                  draw                  .                  rect                  (                  screen                  ,                  Blackness                  ,                  [                  150                  ,                  10                  ,                  l                  ,                  twenty                  ])                  # Draw a rectangle with rounded corners                  pygame                  .                  draw                  .                  rect                  (                  screen                  ,                  Greenish                  ,                  [                  115                  ,                  210                  ,                  70                  ,                  40                  ],                  x                  ,                  border_radius                  =                  15                  )                  pygame                  .                  describe                  .                  rect                  (                  screen                  ,                  Cherry-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 equally the exterior boundaries                  pygame                  .                  draw                  .                  ellipse                  (                  screen                  ,                  Blood-red                  ,                  [                  225                  ,                  10                  ,                  50                  ,                  20                  ],                  2                  )                  # Draw an solid ellipse, using a rectangle equally the outside boundaries                  pygame                  .                  draw                  .                  ellipse                  (                  screen                  ,                  Reddish                  ,                  [                  300                  ,                  10                  ,                  l                  ,                  xx                  ])                  # This draws a triangle using the polygon command                  pygame                  .                  draw                  .                  polygon                  (                  screen                  ,                  BLACK                  ,                  [[                  100                  ,                  100                  ],                  [                  0                  ,                  200                  ],                  [                  200                  ,                  200                  ]],                  five                  )                  # Draw an arc as part of an ellipse.                                    # Use radians to make up one's mind what angle to draw.                  pygame                  .                  draw                  .                  arc                  (                  screen                  ,                  BLACK                  ,[                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  0                  ,                  pi                  /                  2                  ,                  2                  )                  pygame                  .                  draw                  .                  arc                  (                  screen                  ,                  Dark-green                  ,[                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  pi                  /                  2                  ,                  pi                  ,                  2                  )                  pygame                  .                  draw                  .                  arc                  (                  screen                  ,                  Bluish                  ,                  [                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  pi                  ,                  3                  *                  pi                  /                  two                  ,                  2                  )                  pygame                  .                  draw                  .                  arc                  (                  screen                  ,                  RED                  ,                  [                  210                  ,                  75                  ,                  150                  ,                  125                  ],                  iii                  *                  pi                  /                  2                  ,                  2                  *                  pi                  ,                  2                  )                  # Draw a circle                  pygame                  .                  depict                  .                  circle                  (                  screen                  ,                  Blue                  ,                  [                  60                  ,                  250                  ],                  40                  )                  # Draw just i circle quadrant                  pygame                  .                  describe                  .                  circle                  (                  screen                  ,                  Blueish                  ,                  [                  250                  ,                  250                  ],                  xl                  ,                  0                  ,                  draw_top_right                  =                  True                  )                  pygame                  .                  describe                  .                  circle                  (                  screen                  ,                  RED                  ,                  [                  250                  ,                  250                  ],                  40                  ,                  30                  ,                  draw_top_left                  =                  True                  )                  pygame                  .                  describe                  .                  circle                  (                  screen                  ,                  Green                  ,                  [                  250                  ,                  250                  ],                  40                  ,                  xx                  ,                  draw_bottom_left                  =                  True                  )                  pygame                  .                  draw                  .                  circumvolve                  (                  screen                  ,                  Black                  ,                  [                  250                  ,                  250                  ],                  twoscore                  ,                  x                  ,                  draw_bottom_right                  =                  Truthful                  )                  # Get ahead and update the screen with what nosotros've drawn.                  # This MUST happen after all the other drawing commands.                  pygame                  .                  display                  .                  flip                  ()                  # Exist IDLE friendly                  pygame                  .                  quit                  ()                

Edit on GitHub