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 Line Information

The dlineinfo method returns a list of five items. These items describe the area of the line that contains index:

  • X coordinate of the upper-left corner

  • Y coordinate of the upper-left corner

  • Width of the area

  • Height of the area

  • Baseline position of the line, measured from x

Here is an example call:

($x, $y, $w, $h, $base) = $text->lineinfo("index");

Unlike the bboxmethod, even areas not shown (due to nonwrapped characters) are used in the calculations, as long as some of the line is showing. However, if the line is not visible at all on the screen, the list will be empty. If the line happens to wrap to multiple lines, the entire area is used.

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