(If you need to clean your slate, do this:
$slate delete all
The VLToolkit term for something drawn on the screen is picture--more accurately, this refers to an Itcl object that drawn something on the screen, and knows how to relate to other pictures. In this section, we'll just run through the basic pictures provided by VL Toolkit.
The slate has a create operation: it is similar to the canvas' operation, but returns an object identifier instead of a canvas item ID (an integer). The first argument to create is the class of picture we want to create; this is followed by the coordinates of the picture (the number depends on the type of picture), and then by configuration options.
The slate includes equivalents of most of the canvas items; each
supports exactly the same options as the canvas
item. Rectangles look like this:
set rectangle [$slate create Rectangle 50 50 80 80 \
-fill red -outline blue]
Ovals:
set oval [$slate create Oval 200 200 240 220 \
-fill green]
Polygons:
set polygon [$slate create Polygon 100 100 110 80 \
120 100 140 110 120 120 \
110 140 100 120 80 110 100 100 \
-fill blue]
Lines can have arrows at one or both ends:
set line [$slate create Line 240 160 300 160 300 200 \
-arrow last -fill red]
Text is usually created with some text in it:
set text [$slate create Text 100 100 -text Fred]
The slate also provides slightly more sophisticated versions of
some of the canvas items. Images, for example, have a border:
set image [$slate create Image $tychoslate/img/mantra.gif \
100 200]
The slate has psuedo-3D objects, for that fashionable
chunky look. The most commonly-used one is Frame:
set frame [$slate create Frame 200 50 250 100 \
-color green]
set border [$slate create Frame 20 20 350 220 \
-color grey85 -borderwidth 3 \
-fill none -relief ridge]
set arrow [$slate create Solid 332.728 80.3016 \
349.698 97.2721 324.243 122.728 \
332.728 131.213 298.787 131.213 \
298.787 97.272 307.272 105.757 \
-color peachpuff]
$slate delete $rectangle
$line configure -arrow last -smooth on
$frame configure -relief sunken
You can query a picture's options as well:
$line cget -smooth
$frame cget -relief
$frame
configure
, and so on, into the console window.
Last updated: 96/11/06,
comments to: