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.10. Retrieving Bounding Box Coordinates

When we talked about the scrolling region of a canvas, we saw an example of the bboxmethod. The bboxmethod returns a list with four elements that define the area in which all the specified tags exist. The example used the special "all" tag, which refers to every item in the canvas. This was how we used it to define our scrolling region. You can specify more than one tag/ID to search for as follows:

($l, $r, $t, $b) = $canvas->bbox("blue", "red");

Assuming that you have been assigning the tags "blue" and "red" to appropriately color items, this code would return the region in the canvas that encloses all blue and red items.

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