Draw No Draw

Posted onby

draw the curtain

1. To open a curtain in order to see or reveal what is behind it. Please draw the curtain so we can get some more sunlight in here.
2. To conceal something; to keep something a secret. The police have been accused of drawing a curtain on the officer's alleged involvement with the teenager's murder.

Mapbox Draw accepts functionality changes after the functionality has been proven out via a custom mode. This lets users experiment and validate their mode before entering a review process, hopefully promoting innovation. Definition of draw the curtain in the Idioms Dictionary. Draw the curtain phrase. What does draw the curtain expression mean? Definitions by the largest Idiom Dictionary.

Farlex Dictionary of Idioms. © 2015 Farlex, Inc, all rights reserved.

draw the curtain

1. Pull a curtain back or to one side to let in more light or to discover what is behind it. For example, The sun was so pleasant I drew the curtains. [c. 1500]
2. Block or conceal something. For example, Let's draw the curtain over this matter; no one needs to know more. [c. 1500] Also see draw a veil.
The American Heritage® Dictionary of Idioms by Christine Ammer. Copyright © 2003, 1997 by The Christine Ammer 1992 Trust. Published by Houghton Mifflin Harcourt Publishing Company. All rights reserved.
See also:

Want to thank TFD for its existence? Tell a friend about us, add a link to this page, or visit the webmaster's page for free fun content.
Link to this page:
pygame.draw.rectdraw a rectangle
pygame.draw.polygondraw a polygon
pygame.draw.circledraw a circle
pygame.draw.ellipsedraw an ellipse
pygame.draw.arcdraw an elliptical arc
pygame.draw.linedraw a straight line
pygame.draw.linesdraw multiple contiguous straight line segments
pygame.draw.aalinedraw a straight antialiased line
pygame.draw.aalinesdraw multiple contiguous straight antialiased line segments

Draw several simple shapes to a surface. These functions will work forrendering to any format of surface. Rendering to hardware surfaces will beslower than regular software surfaces.

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

All the drawing functions respect the clip area for the surface and will beconstrained to that area. The functions return a rectangle representing thebounding 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 thefollowing formats:

  • a object
  • an (RGB) triplet (tuple/list)
  • an (RGBA) quadruplet (tuple/list)
  • an integer value that has been mapped to the surface's pixel format(see and )

A color's alpha value will be written directly into the surface (if thesurface contains pixel alphas), but the draw function will not drawtransparently.

These functions temporarily lock the surface they are operating on. Manysequential drawing calls can be sped up by locking and unlocking the surfaceobject around the draw calls (see and).

pygame.draw.rect()
rect(surface, color, rect) -> Rect
rect(surface, color, rect, width=0, border_radius=0, border_top_left_radius=-1, border_top_right_radius=-1, border_bottom_left_radius=-1, border_bottom_right_radius=-1) -> 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 alpha value is optional if using atuple (RGB[A])
  • rect (Rect) -- rectangle to draw, position and dimensions
  • width (int) --

    (optional) used for line thickness or to indicate thatthe rectangle is to be filled (not to be confused with the width valueof the rect parameter)

    if width>0, used for line thickness

    Note

    When using width values >1, the edge lines will growoutside the original boundary of the rect. For more details onhow the thickness for edge lines grow, refer to the width notesof the 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 rectanglewithout rounded corners.
  • border_top_left_radius (int) -- (optional) used for setting the value of top leftborder. If you don't set this value, it will use the border_radius value.
  • border_top_right_radius (int) -- (optional) used for setting the value of top rightborder. If you don't set this value, it will use the border_radius value.
  • border_bottom_left_radius (int) -- (optional) used for setting the value of bottom leftborder. If you don't set this value, it will use the border_radius value.
  • border_bottom_right_radius (int) --

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

    if border_radius<1 it will draw rectangle without rounded corners
    if any of border radii has the value <0 it will use value of the border_radius
    If sum of radii on the same side of the rectangle is greater than the rect size the radii
Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the position of the given rectparameter and its width and height will be 0

Return type:

Note

The method works just as well for drawingfilled rectangles and can be hardware accelerated on some platforms withboth software and hardware display modes.

Changed in pygame 2.0.0: Added support for keyword arguments.

Changed in pygame 2.0.0.dev8: Added support for border radius.

pygame.draw.polygon()
polygon(surface, color, points) -> 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 alpha value is optional if using atuple (RGB[A])
  • points (tuple(coordinate) or list(coordinate)) -- a sequence of 3 or more (x, y) coordinates that make up thevertices of the polygon, each coordinate in the sequence must be atuple/list/ of 2 ints/floats,e.g. [(x1,y1),(x2,y2),(x3,y3)]
  • width (int) --

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

    if width > 0, used for line thickness

    Note

    When using width values >1, the edge lines will growoutside the original boundary of the polygon. For more details onhow the thickness for edge lines grow, refer to the width notesof the function.

Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the position of the first point in thepoints parameter (float values will be truncated) and its width andheight will be 0

Return type:
Raises:
  • ValueError -- if len(points)<3 (must have at least 3 points)
  • TypeError -- if points is not a sequence or points does notcontain number pairs

Note

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

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.draw.circle()
circle(surface, color, center, radius) -> Rect
circle(surface, color, center, 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 (Color or int or tuple(int, int, int, [int])) -- color to draw with, the alpha value is optional if using atuple (RGB[A])
  • center (tuple(int or float, int or float) orlist(int or float, int or float) or Vector2(int or float, int or float)) -- center point of the circle as a sequence of 2 ints/floats,e.g. (x,y)
  • radius (int or float) -- 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 thatthe circle is to be filled

    if width>0, used for line thickness

    Note

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

  • draw_top_right (bool) -- (optional) if this is set to True then the top right cornerof the circle will be drawn
  • draw_top_left (bool) -- (optional) if this is set to True then the top left cornerof the circle will be drawn
  • draw_bottom_left (bool) -- (optional) if this is set to True then the bottom left cornerof the circle will be drawn
  • draw_bottom_right (bool) --

    (optional) if this is set to True then the bottom right cornerof the circle will be drawn

    if any of the draw_circle_part is True then it will draw all circle parts that have the True
Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the center parameter value (floatvalues will be truncated) and its width and height will be 0

Return type:
Raises:
  • TypeError -- if center is not a sequence of two numbers
  • TypeError -- if radius is not a number

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

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

pygame.draw.ellipse()
ellipse(surface, color, rect) -> Rect

Draws an ellipse 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 atuple (RGB[A])
  • rect (Rect) -- rectangle to indicate the position and dimensions of theellipse, the ellipse will be centered inside the rectangle and boundedby it
  • width (int) --

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

    if width>0, used for line thickness

    Note

    When using width values >1, the edge lines will only growinward from the original boundary of the rect parameter.

Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the position of the given rectparameter and its width and height will be 0

Return type:

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.draw.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 indicate the start and stoppositions of the arc. The arc is drawn in a counterclockwise direction fromthe start_angle to the stop_angle.

Draw
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 atuple (RGB[A])
  • rect (Rect) -- rectangle to indicate the position and dimensions of theellipse which the arc will be based on, the ellipse will be centeredinside the rectangle
  • start_angle (float) -- start angle of the arc in radians
  • stop_angle (float) --

    stop angle of the arc inradians

    if start_angle<stop_angle, the arc is drawn in acounterclockwise direction from the start_angle to thestop_angle
    if start_angle>stop_angle, tau (tau 2 * pi) will be addedto the stop_angle, if the resulting stop angle value is greaterthan the start_angle the above start_angle<stop_angle caseapplies, otherwise nothing will be drawn

  • width (int) --

    (optional) used for line thickness (not to be confusedwith the width value of the rect parameter)

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

    Note

    When using width values >1, the edge lines will only growinward from the original boundary of the rect parameter.

Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the position of the given rectparameter and its width and height will be 0

Return type:

Changed in pygame 2.0.0: Added support for keyword arguments.

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

Draws a straight line on the given surface. There are no endcaps. For thicklines 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 atuple (RGB[A])
  • start_pos (tuple(int or float, int or float) orlist(int or float, int or float) or Vector2(int or float, int or float)) -- start position of the line, (x, y)
  • end_pos (tuple(int or float, int or float) orlist(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 >= 1, used for line thickness (default is 1)

    Note

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

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

    For even width values, the thickness of each line grows with theoriginal line being offset from the center (as there is no exactcenter line drawn). As a result, lines with a slope < 1(horizontal-ish) will have 1 more pixel of thickness below theoriginal line (in the y direction). Lines with a slope >= 1(vertical-ish) will have 1 more pixel of thickness to the right ofthe original line (in the x direction).

Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the start_pos parameter value (floatvalues will be truncated) and its width and height will be 0

Return type:
Raises:

TypeError -- if start_pos or end_pos is not a sequence oftwo numbers

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.draw.lines()
lines(surface, color, closed, points) -> Rect
lines(surface, color, closed, points, width=1) -> Rect

Draw No Draw 3d

Draws a sequence of contiguous straight lines on the given surface. There areno endcaps or miter joints. For thick lines the ends are squared off.Drawing thick lines with sharp corners can have undesired looking results.

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 atuple (RGB[A])
  • closed (bool) -- if True an additional line segment is drawn betweenthe first and last points in the points sequence
  • points (tuple(coordinate) or list(coordinate)) -- a sequence of 2 or more (x, y) coordinates, where eachcoordinate in the sequence must be atuple/list/ of 2 ints/floats and adjacentcoordinates will be connected by a line segment, e.g. for thepoints [(x1,y1),(x2,y2),(x3,y3)] a line segment will be drawnfrom (x1,y1) to (x2,y2) and from (x2,y2) to (x3,y3),additionally if the closed parameter is True another line segmentwill 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)

    Note

    When using width values >1 refer to the width notesof line() for details on how thick lines grow.

Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the position of the first point in thepoints parameter (float values will be truncated) and its width andheight will be 0

Return type:
Raises:
  • ValueError -- if len(points)<2 (must have at least 2 points)
  • TypeError -- if points is not a sequence or points does notcontain number pairs

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.draw.aaline()
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 have a height andwidth of one pixel each.

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

If both endpoints are equal, only a single pixel is drawn (afterrounding floats to nearest integer).

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

For each endpoint:

If x, the endpoint's x-coordinate, is a whole number findwhich pixels would be covered by it and draw them.

Otherwise:

Calculate the position of the nearest point with a whole numberfor it's x-coordinate, when extending the line past theendpoint.

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

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 x.

Then draw those pixels.

e.g.:
The left endpoint of the line ((1,1.3),(5,3)) wouldcover 70% of the pixel (1,1) and 30% of the pixel(1,2) while the right one would cover 100% of thepixel (5,3).
The left endpoint of the line ((1.2,1.4),(4.6,3.1))would cover 56% (i.e. 0.8 * 70%) of the pixel (1,1)and 24% (i.e. 0.8 * 30%) of the pixel (1,2) whilethe right one would cover 42% (i.e. 0.6 * 70%) of thepixel (5,3) and 18% (i.e. 0.6 * 30%) of the pixel(5,4) while the right

Then for each point between the endpoints, along the line, whosex-coordinate is a whole number:

Find which pixels would be covered and how much by that point anddraw them.

e.g.:
The points along the line ((1,1),(4,2.5)) would be(2,1.5) and (3,2) and would cover 50% of the pixel(2,1), 50% of the pixel (2,2) and 100% of the pixel(3,2).
The points along the line ((1.2,1.4),(4.6,3.1)) wouldbe (2,1.8) (covering 20% of the pixel (2,1) and 80%of the pixel (2,2)), (3,2.3) (covering 70% of thepixel (3,2) and 30% of the pixel (3,3)) and (4,2.8) (covering 20% of the pixel (2,1) and 80% of thepixel (2,2))

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

Draw

Note

Regarding float values for coordinates, a point with coordinateconsisting of two whole numbers is considered being right in the centerof said pixel (and having a height and width of 1 pixel would thereforecompletely cover it), while a point with coordinate where one (or both)of the numbers have non-zero decimal parts would be partially coveringtwo (or four if both numbers have decimal parts) adjacent pixels, e.g.the point (1.4,2) covers 60% of the pixel (1,2) and 40% of thepixel (2,2).

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 atuple (RGB[A])
  • start_pos (tuple(int or float, int or float) orlist(int or float, int or float) or Vector2(int or float, int or float)) -- start position of the line, (x, y)
  • end_pos (tuple(int or float, int or float) orlist(int or float, int or float) or Vector2(int or float, int or float)) -- end position of the line, (x, y)
  • blend (int) -- (optional) if non-zero (default) the line will be blendedwith the surface's existing pixel shades, otherwise it will overwrite them
Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the start_pos parameter value (floatvalues will be truncated) and its width and height will be 0

Return type:
Raises:

TypeError -- if start_pos or end_pos is not a sequence oftwo numbers

Draw No Drawings

Changed in pygame 2.0.0: Added support for keyword arguments.

pygame.draw.aalines()
draw multiple contiguous straight antialiased line segments
aalines(surface, color, closed, points, blend=1) -> Rect

Draws a sequence of contiguous straight antialiased lines on the givensurface.

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 atuple (RGB[A])
  • closed (bool) -- if True an additional line segment is drawn betweenthe first and last points in the points sequence
  • points (tuple(coordinate) or list(coordinate)) -- a sequence of 2 or more (x, y) coordinates, where eachcoordinate in the sequence must be atuple/list/ of 2 ints/floats and adjacentcoordinates will be connected by a line segment, e.g. for thepoints [(x1,y1),(x2,y2),(x3,y3)] a line segment will be drawnfrom (x1,y1) to (x2,y2) and from (x2,y2) to (x3,y3),additionally if the closed parameter is True another line segmentwill be drawn from (x3,y3) to (x1,y1)
  • blend (int) -- (optional) if non-zero (default) each line will be blendedwith the surface's existing pixel shades, otherwise the pixels will beoverwritten
Returns:

a rect bounding the changed pixels, if nothing is drawn thebounding rect's position will be the position of the first point in thepoints parameter (float values will be truncated) and its width andheight will be 0

Return type:
Raises:
  • ValueError -- if len(points)<2 (must have at least 2 points)
  • TypeError -- if points is not a sequence or points does notcontain number pairs

Draw No Draw Online

Changed in pygame 2.0.0: Added support for keyword arguments.