Node:canvas, Next:, Previous:Tricks, Up:Tricks



Drawing arbitrary objects on canvas

The canvas object, used internally by PyChart, can be invoked manually if you desire so.

canvas.line LINESTYLE, X1, Y1, X2, Y2 Function

# draw a line segment from (10,20) to (100, 200)
canvas.line(line_style.blackdash1, 10, 20, 100, 200)

canvas.polygon LINESTYLE, FILLSTYLE, [(X1,Y1), ..., (Xn, Yn)] Function

Draw a polygon with LINESTYLE (see line_style), fill with FILLSTYLE (see fill_style), and the edges POINTS. POINTS is a list of corrdinates, e.g., ((10,10), (15,5), (20,8)). SHADOW is either None or a tuple (XDELTA, YDELTA, SHADOWSTYLE). If non-null, a shadow of SHADOWSTYLE (see fill_style)is drawn beneath the polygon at the offset of (XDELTA, YDELTA). LINESTYLE can be None, in which case no perimeter lines are drawn. FILLSTYLE (see fill_style) can also be None, in which the internal of the polygon are left undrawn.

canvas.polygon(line_style.default, fill_style.default,
               [(10, 20), (100, 200), (300,300)])

canvas.rectangle LINESTYLE, FILLSTYLE, X1, Y1, X2, Y2, SHADOW=None Function

Parameter shadow, if none, draws a drop-shadow. It should be a tuple of three values, (x_off, y_off, fill).

canvas.rectangle(line_style.default, fill_style.default,
                 10, 20, 300, 300)

canvas.ellipsis LINESTYLE, FILLSTYLE, X, Y, RADIUS, Y-ELONGATION=1, START=0, END=360, SHADOW=None Function

The start and end angles are specified in degrees; i.e., between 0 and 360. Parameter shadow, if none, draws a drop-shadow. It should be a tuple of three values, (x_off, y_off, fill).

canvas.round_rectangle LINESTYLE, FILLSTYLE, X1,Y2,X2,Y2,RADIUS,SHADOW=None Function
Draw a rectangle with rounded four corners.

Parameter shadow, if none, draws a drop-shadow. It should be a tuple of three values, (x_off, y_off, fill).

canvas.curve LINESTYLE, [(X1,Y2), ..., (Xn, Yn)] Function
Draw a Bezier curve.

canvas.show X, Y, TEXT Function
TEXT supports font manipulation, as defined in See font.

canvas.verbatim STR Function

This procedure outputs an arbitrary Postscript code STR.