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


In reply to Perl/Tk canvas clearing by Kickstart

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.