in reply to Re^2: Query the height of Tk::Text widget with word wrap
in thread Query the height of Tk::Text widget with word wrap
use strict; use warnings; use Tk; my $mw = Tk::MainWindow->new; $mw->geometry('400x300'); my $tw = $mw->Text(-wrap=>'word')->pack(qw/ -expand 1 -fill both /); $tw->insert('end', q{"There must be some kind of way out of here," Said the joker to the +thief. "There's too much confusion, I can't get no relief. Businessme +n, they drink my wine, Plowmen dig my earth. None of them along the l +ine Know what any of it is worth." "No reason to get excited," The th +ief he kindly spoke. "There are many here among us Who feel that life + is but a joke. But you and I, we've been through that, And this is n +ot our fate. So let us not talk falsely now, The hour is getting late +." All along the watchtower, Princes kept the view, While all the wom +en came and went -- Barefoot servants too. Outside in the cold distan +ce, A wildcat did growl. Two riders were approaching, and The wind be +gan to howl. http://www.reasontorock.com/tracks/watchtower.html}); $tw->pack(); my @indexes = qw/ 1.0 1.11 1.20 /; for my $index (@indexes) { my @dline = $tw->dlineinfo("$index wordstart"); print "dline info for $index: " . join (' ', @dline) . "\n"; } MainLoop;
dline info for 1.0: 3 3 7 1 11 dline info for 1.11: dline info for 1.20:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Query the height of Tk::Text widget with word wrap
by Anonymous Monk on Dec 01, 2013 at 13:04 UTC | |
by elef (Friar) on Dec 02, 2013 at 11:15 UTC | |
by Anonymous Monk on Dec 02, 2013 at 11:34 UTC | |
by elef (Friar) on Dec 02, 2013 at 17:07 UTC | |
|