next up previous contents index
Next: 16.1.4 Menu Objects Up: 16.1 Built-in Module stdwin Previous: 16.1.2 Window Objects

16.1.3 Drawing Objects

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)
Draw a box just inside a rectangle.

circle(center, radius)
Draw a circle with given center point and radius.

elarc(center, tex2html_wrap16642 , tex2html_wrap16643 )
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)
Erase a rectangle.

fillcircle(center, radius)
Draw a filled circle with given center point and radius.

fillelarc(center, tex2html_wrap16642 , tex2html_wrap16643 )
Draw a filled elliptical arc; arguments as for elarc.

fillpoly(points)
Draw a filled polygon given by a list (or tuple) of points.

invert(rect)
Invert a rectangle.

line(p1, p2)
Draw a line from point p1 to p2.

paint(rect)
Fill a rectangle.

poly(points)
Draw the lines connecting the given list (or tuple) of points.

shade(rect, percent)
Fill a rectangle with a shading pattern that is about percent percent filled.

text(p, str)
Draw a string starting at point p (the point specifies the top left coordinate of the string).

xorcircle(center, radius)
,xorelarccenter, tex2html_wrap16642 , tex2html_wrap16643 ,xorlinep1, p2 ,xorpolypoints Draw a circle, an elliptical arc, a line or a polygon, respectively, in XOR mode.

setfgcolor()
,setbgcolor ,getfgcolor ,getbgcolor 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()
,baseline ,lineheight ,textbreak ,textwidth 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)
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). Not available on the Macintosh.

cliprect(rect)
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.

noclip()
Reset the clipping region to the entire window.

close()
,enddrawing Discard the drawing object. It should not be used again.


next up previous contents index
Next: 16.1.4 Menu Objects Up: 16.1 Built-in Module stdwin Previous: 16.1.2 Window Objects

guido@cnri.reston.va.us