An overview of complex item classes

The Slate (and IncrCanvas) make it easy to define new complex item types in [incr Tcl] The Tycho distribution includes a number of complex items types. Here is an overview. For each group of items, there is an example; go to the specific class for more detailed examples.

Pseudo-3D items

The Slate has two item pseudo-3D item types: rectangles and polygons. We did at one time implement a pseudo-3D oval but it's rather hard to make it look reasonable using just the Tk canvas.

Both of these item types have the following options:

Frame and Solid implement their scaling code so that the borderwidth remains constant when the picture is resized.

Example: Create some Frames and Solids with various options:

  set slate [::tycho::Slate::demoslate]
  $slate create Frame 30 70 70 90 -color green -tags moveable
  $slate create Frame 100 120 120 140 -color lightblue \
	-relief ridge -tags moveable
  $slate create Frame 30 130 70 150 -relief sunken  \
	-borderwidth 4 -tags moveable
  $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

Labeled items

The Slate has a number of item types that extend simpler item with a text label and with arbitrary graphics. All of these item types inherit from the LabeledItem class. All of them thus have at least these options:

There are three subclasses of LabeledItem: Both LabeledRect and LabeledOval have the following options: LabeledFrame has all the options of Frame.

Examples: Create some labeled items with various options:

  set slate [::tycho::Slate::demoslate]
  $slate create LabeledOval 40 40 100 80 -fill white -outline blue \
		-width 4 -text Foo -tags moveable
  $slate create LabeledRect 120 120 180 160 -fill blue -outline red \
		-anchor nw -text Foo -tags moveable \
		-graphics "line 0 0 100 100; line 0 100 100 0"
  $slate create LabeledFrame 200 40 260 80 -color green \
		-text Foo -tags moveable \
		-graphics "Frame 25 25 75 75 -color green -relief sunken"

Line items

The Slate has two complex line items.:

Options of SmartLine include the following:

Examples: Create some lines:

  set slate [::tycho::Slate::demoslate]
  $slate create SmartLine 50 50 150 150 -tags moveable
  $slate create SmartLine 200 50 240 60 -end w -tags moveable
  $slate create SmartLine 50 100 50 180 -end s -tags moveable

Back up
Tycho Home Page


Copyright © 1996-1998, The Regents of the University of California. All rights reserved.
Last updated: 05/22/98, comments to: johnr@eecs.berkeley.edu