Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Perl::Tk--Center line in Text Widget

by Kirsle (Pilgrim)
on Dec 18, 2009 at 23:24 UTC ( #813454=note: print w/replies, xml ) Need Help??


in reply to Perl::Tk--Center line in Text Widget

If you have, say, 100 lines in the text file and only 10 lines are visible at any time in the text widget, and you want line 50 to be shown in the center of the widget... $text->see(50) will scroll it so that line 50 is at the bottom of the text box, but if you did instead $text->see(50 + 5) then it would show line 55 at the bottom of the text box, and line 45 at the top - 50 being approximately right in the center.

Then to guarantee it will be in the center even if the text widget needed to scroll up to see it, you could first call $text->see(45) and then $text->see(55).

  • Comment on Re: Perl::Tk--Center line in Text Widget

Replies are listed 'Best First'.
Re^2: Perl::Tk--Center line in Text Widget
by vlsimpson (Beadle) on Dec 19, 2009 at 07:29 UTC

    Excellent, that looks like it'll do it. I'll give it a whirl in the morning (well, my later morning).

    Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://813454]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2021-09-20 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?