ccanvas is a thin wrapper around the Tk canvas that allows all coordinates, lengths and angles to be given as expressions.

Coordinates and lengths can have units: centimeters, inches, millimeters, points, pixels or % of screen size. New length units can be added (see addLengthUnit subcommand). Angles can be in degrees, radians or revolutions (1R=360 degrees). The scaling from length units to pixels can be set using the -scale option for each ccanvas window. Units are a convenience feature, as with canvas, the values are saved as pixels or degrees within the canvas widget.

ccanvas adds several new subcommands, some are:

dup -- duplicate an item or group of tagged items, optionally updating the duplicate items configuration

flip -- reflect an item or group of tagged items in a vertical line

flop -- reflect an item or group of tagged items in a horizontal line

crotate -- similar to Tk8.7 rotate, but tries (and sometimes fails) to handle more than just the item coordinates.

expr -- do calculations using the canvas scaling, optionally with reference to an items coordinates

exprs -- similar to expr, but does multiple calculations, returning a list of results

An Example:

Draw a red line 1.5 millimeters wide on the canvas .c Starting at coordinates in variables xo and yo, go 1.2 inches to the right, then 5 centimeters down

.c create line  $xo $yo  x+1.2i y  x y+5c  -width 1.5m  -fill red

Manual page


ccanvas is implemented as a snit widget adapter. It is fairly easy to add new ccanvas subcommands (as snit methods).

Things change to track changes in canvas, and as it gets used.