Next: Menu Object Prev: Window Object Up: stdwin Top: Top

8.1.3. Drawing Object Methods

Drawing objects are created exclusively by the window method begindrawing(). Only one drawing object can exist at any given time; the drawing object must be deleted to finish drawing. No drawing object may exist when stdwin.getevent() is called. Drawing objects have the following methods:

box (rect) -- Method on drawing
Draw a box just inside a rectangle.
circle (center, radius) -- Method on drawing
Draw a circle with given center point and radius.
elarc (center, (rh, rv), (a1, a2)) -- Method on drawing
Draw an elliptical arc with given center point. (rh, rv) gives the half sizes of the horizontal and vertical radii. (a1, a2) gives the angles (in degrees) of the begin and end points. 0 degrees is at 3 o'clock, 90 degrees is at 12 o'clock.
erase (rect) -- Method on drawing
Erase a rectangle.
fillcircle (center, radius) -- Method on drawing
Draw a filled circle with given center point and radius.
fillelarc (center, (rh, rv), (a1, a2)) -- Method on drawing
Draw a filled elliptical arc; arguments as for elarc.
fillpoly (points) -- Method on drawing
Draw a filled polygon given by a list (or tuple) of points.
invert (rect) -- Method on drawing
Invert a rectangle.
line (p1, p2) -- Method on drawing
Draw a line from point p1 to p2.
paint (rect) -- Method on drawing
Fill a rectangle.
poly (points) -- Method on drawing
Draw the lines connecting the given list (or tuple) of points.
shade (rect, percent) -- Method on drawing
Fill a rectangle with a shading pattern that is about percent percent filled.
text (p, str) -- Method on drawing
Draw a string starting at point p (the point specifies the top left coordinate of the string).
xorcircle (center, radius) -- Method on drawing
xorelarc (center, (rh, rv), (a1, a2)) -- Method on drawing
xorline (p1, p2) -- Method on drawing
xorpoly (points) -- Method on drawing
Draw a circle, an elliptical arc, a line or a polygon, respectively, in XOR mode.
setfgcolor () -- Method on drawing
setbgcolor () -- Method on drawing
getfgcolor () -- Method on drawing
getbgcolor () -- Method on drawing
These functions are similar to the corresponding functions described above for the stdwin module, but affect or return the colors currently used for drawing instead of the global default colors. When a drawing object is created, its colors are set to the window's default colors, which are in turn initialized from the global default colors when the window is created.
setfont () -- Method on drawing
baseline () -- Method on drawing
lineheight () -- Method on drawing
textbreak () -- Method on drawing
textwidth () -- Method on drawing
These functions are similar to the corresponding functions described above for the stdwin module, but affect or use the current drawing font instead of the global default font. When a drawing object is created, its font is set to the window's default font, which is in turn initialized from the global default font when the window is created.
bitmap (point, bitmap, mask) -- Method on drawing
Draw the bitmap with its top left corner at point. If the optional mask argument is present, it should be either the same object as bitmap, to draw only those bits that are set in the bitmap, in the foreground color, or None, to draw all bits (ones are drawn in the foreground color, zeros in the background color).
cliprect (rect) -- Method on drawing
Set the ``clipping region'' to a rectangle. The clipping region limits the effect of all drawing operations, until it is changed again or until the drawing object is closed. When a drawing object is created the clipping region is set to the entire window. When an object to be drawn falls partly outside the clipping region, the set of pixels drawn is the intersection of the clipping region and the set of pixels that would be drawn by the same operation in the absence of a clipping region. clipping region
noclip () -- Method on drawing
Reset the clipping region to the entire window.
close () -- Method on drawing
enddrawing () -- Method on drawing
Discard the drawing object. It should not be used again.