Book HomeMastering Perl/TkSearch this book

8.12. Getting the Size of a Character

The bbox method returns a list containing four items that describe the box around the character at index:

($x, $y, $w, $h) = $text->bbox(index);

The first two items returned are the x and y coordinates of the upper-left corner. The last two are the width and height of the box. The bounding box describes only the visible portion of the character, so if it is half hidden or not visible at all, the values returned will reflect this.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.