Skip to Main Content
Learning Perl/Tk
book

Learning Perl/Tk

by Nancy Walsh
January 1999
Beginner content levelBeginner
373 pages
9h 43m
English
O'Reilly Media, Inc.
Content preview from Learning Perl/Tk

9.5. Canvas Options

The options listed in this section affect the entire canvas widget and the items within it. Items are circles, lines, rectangles, text, or other widgets. These options act as you would expect them to (as explained in Chapter 3, for most options and in Chapter 6 for the scrollbar options): -background, -borderwidth, -cursor, -height, -highlightbackground, -highlightcolor, -highlightthickness, -relief, -takefocus, -width, -xscrollcommand, and -yscrollcommand.

9.5.1. New Options

When selecting items in the canvas with the mouse cursor, the canvas widget does calculations to determine if the mouse cursor is inside or outside the item. The -closeenough option controls how close the mouse must be to the item before it is considered inside the item. The default value for -closeenough is "1.0", which is 1.0 pixels away. Any floating point number is a valid value (and will always be in pixels) for -closeenough.

I discussed the -scrollregion option briefly in "The Scrollable Region" earlier in this chapter. It takes a list reference, and that list 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.

Normally, the canvas widget limits the user to seeing only the area defined by the -scrollregion option. You can allow the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Perl/Tk

Mastering Perl/Tk

Stephen Lidie, Nancy Walsh

Publisher Resources

ISBN: 1565923146Supplemental ContentCatalog PageErrata