in reply to Perl/tk program structure for multiple screens
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.
|
|---|