Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Tk: Make lines disappear in a Text widget?

by converter (Priest)
on Oct 09, 2003 at 17:46 UTC ( #298020=note: print w/ replies, xml ) Need Help??


in reply to Tk: Make lines disappear in a Text widget?

Invoke tagConfigure with the -state parameter, with a value 'hidden'. When this tag is added to a range, the text will not be displayed in the text widget. Invoking tagRemove with the tag name and range will make the text visible again.

# A quick demo: hide the selected text, # press the Escape key to make hidden # text visible again $mw = tkinit; $t = $mw->Text->pack; $t->tagConfigure( 'hide', -state => 'hidden', ); $b = $mw->Button( -text => 'Hide', -command => \&hide_text, )->pack; $mw->bind('<Escape>', \&show_text); MainLoop; sub show_text { my @r = $t->tagRanges('hide'); return unless @r; $t->tagRemove('hide', @r); return; } sub hide_text { my @r = $t->tagRanges('sel'); return unless @r; $t->tagAdd('hide',@r); return; }


Comment on Re: Tk: Make lines disappear in a Text widget?
Select or Download Code
Re: Re: Tk: Make lines disappear in a Text widget?
by bschmer (Friar) on Oct 09, 2003 at 18:25 UTC
    Must be the version of Tk that I'm using. I'll update to the latest and try again.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2014-07-23 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (152 votes), past polls