Pseudo-3D items
The Slate has two item pseudo-3D item types: rectangles and polygons.
We did at one time implement a psuedo-3D oval but it's rather hard to
make it look reasonable using just the Tk canvas.
Frame is a pseudo-3D rectangle. It has the following options:
- -borderwidth. The width of the border of the item. By
default, it is two. For various reasons, the borderwidth is actually
twice this value if the
-relief
option is groove
or ridge.
- -color. The color of the item. This is a "generic" color as
implemented by the Shades class
-- this will soon be replaced by an enhanced version of ColorManager. By
default, the color is the same as the standard Tk background color
("grey85").
- -relief. The "relief" of the pseudo-3D item. This can be
one of: raised, sunken, groove, ridge, or
flat. The meanings of these are the same as for the Tk
frame
widget. The default is raised.
Frame implements its scaling code so that the borderwidth remains
constant when the picture is resized. In all other respects, it can be
treated like any other rectangular item.
Enhancements: In an earlier version of the Slate, the Frame
had an additional option,-fill
, which could take
values none, gloss, and matt. In the first
case, the Frame had no "surface" -- that is, it was transparent, which
was particularly useful if -relief
was ridge. This
should be reimplemented.
Example: Create some Frames with various options:
source $tycho/editors/slate/doc/internals/newslate.itcl
$slate create Frame 30 30 70 50 -color green -tags moveable
$slate create Frame 100 20 120 40 -color lightblue -relief ridge -tags moveable
$slate create Frame 30 130 70 150 -relief sunken -borderwidth 4 -tags moveable
Solid is a pseudo-3D polygon. It has the following options:
- -borderwidth. See the Frame item.
- -color. See the Frame item.
- -relief. See the Frame item.
Solid implements its scaling code so that the borderwidth remains
constant when the picture is resized. Its coordinates, (like the
standard Tk canvas polygon item) are a list of vertex
coordinates. They must, however, be in a "clockwise" direction for the
borders to be drawn properly.
Enhancements: (i) See the remark about -fill
option in the Frame section. (ii) In an earlier version of the Slate,
Solid had methods to rotate and "flip" itself -- this should
be reimplemented.
Example: Create some Solids with various options:
source $tycho/editors/slate/doc/internals/newslate.itcl
$slate create Solid 100 20 120 20 120 10 140 30 120 50 120 40 100 40 \
-color green -tags moveable
$slate create Solid 60 20 60 40 40 40 \
-color grey -borderwidth 3 -tags moveable
Back up
Tycho Home Page
Copyright © 1996, The Regents of the University of California.
All rights reserved.
Last updated: 96/12/11,
comments to: johnr@eecs.berkeley.edu