[ Team LiB ] Previous Section Next Section

Canvas Attributes

Table 37-14 lists the attributes for the canvas widget. The table uses the resource name, which has capitals at internal word boundaries. In Tcl commands, the attributes are specified with a dash and are all lowercase.

Table 37-14. Canvas attribute resource names

background

The normal background color.

borderWidth

The width of the border around the canvas.

closeEnough

Distance from mouse to an overlapping object.

confine

Boolean. True constrains the view to the scroll region.

cursor

Cursor to display when mouse is over the widget.

height

Height, in screen units, of canvas display.

highlightBackground

Focus highlight color when widget does not have focus.

highlightColor

Color for input focus highlight border.

highlightThickness

Width of highlight border.

insertBackground

Background for area covered by insert cursor.

insertBorderwidth

Width of cursor border. Nonzero for 3D effect.

insertOffTime

Time, in milliseconds the insert cursor blinks off.

insertOnTime

Time, in milliseconds the insert cursor blinks on.

insertWidth

Width of insert cursor. Default is 2.

relief

flat, sunken, raised, groove, solid, or ridge.

scrollRegion

Left, top, right, and bottom coordinates of the canvas.

selectBackground

Background color of selection.

selectForeground

Foreground color of selection.

selectBorderWidth

Width of selection border. Nonzero for 3D effect.

state

The default state for canvas objects: normal or disabled. (Tk 8.3)

takeFocus

Controls focus changes from keyboard traversal.

width

Width in screen units for viewable area.

xScrollCommand

Tcl command prefix for horizontal scrolling.

xScrollIncrement

Distance for one scrolling unit in the X direction.

yScrollCommand

Tcl command prefix for vertical scrolling.

yScrollIncrement

Distance for one scrolling unit in the Y direction.

The scroll region of a canvas defines the boundaries of the canvas coordinate space. It is specified as four coordinates, x1 y1 x2 y2 where (x1, y1) is the top-left corner and (x2, y2) is the lower-right corner. If the confine attribute is true, then the canvas cannot be scrolled outside this region. It is OK to position canvas objects partially or totally off the scroll region; they just may not be visible. The scroll increment attributes determine how much the canvas is scrolled when the user clicks on the arrows in the scrollbar.

The closeEnough attribute indicates how far away a position can be from an object and still be considered to overlap it. This applies to the overlapping search criteria.

    [ Team LiB ] Previous Section Next Section