O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required