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:
In reply to Re^3: Query the height of Tk::Text widget with word wrap
by elef
in thread Query the height of Tk::Text widget with word wrap
by elef
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |