Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Perl/Tk canvas clearing

by Kickstart (Pilgrim)
on Dec 02, 2001 at 09:27 UTC ( [id://128968]=perlquestion: print w/replies, xml ) Need Help??

Kickstart has asked for the wisdom of the Perl Monks concerning the following question:

I'm noticing a real lack of decent examples and help info for Perl/Tk, so hopefully, in asking questions here, the search engines will make that a little different.

I have created text with the following on a canvas in Perl/Tk

# Create main area for displaying info my $mainarea = $mw->Canvas; $mainarea->pack(-fill => 'both', -expand => 'yes'); $mainarea->configure(-background => "#AAAAAA",); # Define updates to main window # ----------------------------- # FILESYSTEMS sub fs_sub { $mainarea->createText(10, 10, -text => "Filesystem Information:", -anchor => 'w'); }; # MEMORY sub mem_sub{ $mainarea->createText(10, 10, -text => "Memory Information:", -anchor => 'w'); };

The problem is, once I make a menu choice that draws the text (in each subroutine), then go to choose another menu item that draws text, the canvas isn't cleared before the new text is drawn. How can I simple revert the canvas to it's original state? There doesn't seem a decent way to do this.

thanks!

Kickstart

Replies are listed 'Best First'.
Re: Perl/Tk canvas clearing
by ariels (Curate) on Dec 02, 2001 at 12:43 UTC
    Try the method delete from The fine manual. The tag all will allow you to delete all items, or you can delete selectively by item ids (or by other tags).

    In short, $mainarea->delete('all') should delete all items on the canvas.

      Thanks, I got the impression from other docs that this would actually kill the canvas itself. I'll give it a try! Kickstart

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found