In general, in a big program like you propose, your main concern in design is to prevent unwanted memory gains from too many widgets laying around unused/discarded. So think "reuse all widgets".

So I need a way to either clear all the values of the widgets on that screen before re-displaying it or a way to delete the widgets and re-define/re-pack them onto that frame.

It depends on the widget, but every widget can be emptied of it's current data, and refilled. For instance the Listbox, can use an array reference as it's -textvariable option. So all you need to do is change the array and the Listbox will change. Photo widgets can be reused with the blank and read method. If you change the Photo widget's data, it will automatically change in any widget that displays it. Photo objects are the number one culprit in wasted memory, so reuse them. Similarly, Canvas and Text widgets can be blanked out and reused.

If you need help on how to reuse any widget, post a node about that particular widget.

If you want to see an example of a complex juggling act of widget reuse, see ztkdb-sql In that I have a predetermined number of widgets, which I constantly update with new data. It will run all day with no appreciable memory gain.


I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: Perl/tk program structure for multiple screens by zentara
in thread Perl/tk program structure for multiple screens by Theo_124

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.