The options listed in this section affect the entire Canvas widget and the items within it (such as circles, lines, rectangles, text, or other widgets). The following options act as you would expect (as explained in Chapter 4, " Button, Checkbutton, and Radiobutton Widgets" for most options and in Chapter 6, "The Scrollbar Widget" for the Scrollbar options): -background, -borderwidth, -cursor, -height,-highlightbackground, -highlightcolor, -highlightthickness, -relief, -takefocus, -width, -xscrollcommand, and -yscrollcommand.
We discussed the -scrollregion option briefly in Section 9.3, "The Scrollable Region" earlier in this chapter. It takes an array reference, which must contain four coordinates. The coordinates indicate a bounding region for the scrollable area in the Canvas. The coordinates are in this order: [ minx, miny, maxx, maxy ]. You can also think of the coordinates as if they were defining the [ left, top, right, bottom ] edges of the scrollable region.
Jan Nijtman's "dash and image" patches have been incorporated into Perl/Tk. In Chapter 17, "Images and Animations" we investigate the basic features of stipples and Jan's tiles. Here we introduce his Canvas "dash and tile" options. They are applicable to most Canvas items, although only -state and -updatecommand apply to embedded widgets.
The following describes a dashSpec and specifies how a dashed line is drawn.
-dash => '.' = -dash => [2,4] -dash => '-' = -dash => [6,4] -dash => '-.' = -dash => [6,4,2,4] -dash => '-..' = -dash => [6,4,2,4,2,4] -dash => '. ' = -dash => [2,8] -dash => ',' = -dash => [4,4]
The -xscrollcommand and -yscrollcommand options both work as described in Chapter 6, "The Scrollbar Widget", but there are two additional options that affect how the Canvas scrolls its contents: -xscrollincrement and -yscrollincrement. Each option takes a valid screen distance for a value. This distance is the unit the Canvas will use to scroll in the associated direction. For instance, if you specify -xscrollincrement => 10, each time you click an arrow on the horizontal Scrollbar, the contents of the Canvas will shift so the left edge of the contents is an even multiple of 10. Essentially, the Canvas will shift the contents 10 pixels in the arrow's direction.
If the value associated with -xscrollincrement or -yscrollincrement is 0 or less, scrolling is done in normal increments.
These options all are used with the Canvas method:
Copyright © 2002 O'Reilly & Associates. All rights reserved.