3.3.4.5 Common Methods of Drawable Objects

line( coordseq[, tex2html_wrap_inline$<$optionstex2html_wrap_inline$>$])
Draws a line connecting the points in the given coordinate sequence. For more information about the choices available for options, see Section 3.3.4.

polygon( coordseq[, tex2html_wrap_inline$<$optionstex2html_wrap_inline$>$])
Draws a line connecting the points in the given coordinate sequence, and additionally draws an extra line connecting the first and the last point in the sequence. If a fill color or pattern is specified, the polygon is filled with that color or pattern. For more information about the choices available for options, see Section 3.3.4.

rectangle( coordseq[, tex2html_wrap_inline$<$optionstex2html_wrap_inline$>$])
Draws rectangles between pairs of coordinates in the given sequence. The coordinates specify the top-left and the bottom- right corners of the rectangle. The sequence must have an even number of coordinates. For more information about the choices available for options, see Section 3.3.4.

ellipse( coordseq[, tex2html_wrap_inline$<$optionstex2html_wrap_inline$>$])
Draws ellipses between pairs of coordinates in the given sequence. The coordinates specify the top-left and bottom-right corners of the rectangle inside which the ellipse is contained. The sequence must have an even number of coordinates. For more information about the choices available for options, see Section 3.3.4.

pieslice( coordseq, start, end[, tex2html_wrap_inline$<$optionstex2html_wrap_inline$>$])
Draws pie slices contained in ellipses between pairs of coordinates in the given sequence. The start and end parameters are floats that specify the start and end points of pie slice as the starting and ending angle in radians. The angle 0 is to the right, the angle pi/2 is straight up, pi is to the left and-pi/2 is straight down. coordseq is interpreted the same way as for the ellipse method. For more information about the choices available for options, see Section 3.3.4.

arc( coordseq, start, end[, tex2html_wrap_inline$<$optionstex2html_wrap_inline$>$])
Draws arcs contained in ellipses between pairs of coordinates in the given sequence. The start and end parameters are floats that specify the start and end points of pie slice as the starting and ending angle in radians. The angle 0 is to the right, the angle pi/2 is straight up, pi is to the left and-pi/2 is straight down. coordseq is interpreted the same way as for the ellipse method. For more information about the choices available for options, see Section 3.3.4.

point( coordseq[, tex2html_wrap_inline$<$optionstex2html_wrap_inline$>$])
Draws points in each coordinate in the given coordinate sequence. If the width option is set to greater than 1, draws a crude approximation of a circle filled with the outline color in the locations. Note that the approximation is not very accurate for large widths; use the ellipse method if you need a precisely formed circle. For more information about the choices available for options, see Section 3.3.4.

clear( [color=0xffffff])
Sets the entire surface of the drawable to the given color, white by default.

text( coordseq, text[fill=0, font=None])
Draws the given text in the points in the given coordinate sequence with the given color (default value is black) and the given font. The font specification format is described above.

measure_text( text[font=None, maxwidth=-1, maxadvance=-1])
Measures the size of the given text when drawn using the given font. Optionally you can specify the maximum width of the text or the maximum amount the graphics cursor is allowed to move (both in pixels).

Returns a tuple of three values:

blit( image[,target=(0,0), source=((0,0),image.size), mask=None, scale=0])
Copies the source area from the given image to the target area in this drawable. The source area is copied in its entirety if mask is not given or is set to None. If the mask is given, the source area is copied where the mask is white. mask can be either None, a 1-bit (black and white) Image or a grayscale Image, and must be of the same size as the source image. A grayscale mask acts as an alpha channel, i.e. partial transparency.

target and source specify the target area in this image and the source area in the given source. They are coordinate sequences of one or two coordinates. If they specify one coordinate, it is interpreted as the upper-left corner for the area; if they specify two coordinates, they are interpreted as the top-left and bottom-right corners of the area.

If scale is other than zero, scaling is performed on the fly while copying the source area to the target area. If scale is zero, no scaling is performed, and the size of the copied area is clipped to the smaller of source and target areas.

Note that a blit operation with scaling is slower than one without scaling. If you need to blit the same Image many times in a scaled form, consider making a temporary Image of the scaling result and blitting it without scaling. Note also that the scaling performed by the blit operation is much faster but of worse quality than the one done by the resize method, since the blit method does not perform any antialiasing.

See About this document... for information on suggesting changes.