in reply to Modifying Tk widgets via references
I am learning Tk right now and probably can't help you with your main problem, but i was experimenting with something involving multiple top level widgets today and you should know that Tk never lets go of the widget occupied memory after "destroy". i think this is an acknowledged flaw. Today i had a 5mg (resident ram) program double in size after i destroyed/recreated a top level widget ten times! If you have a way to watch this check out it's significance to your situation.
What works great (i will try to come up with some brief code and maybe references) is to start the different top levels "-state=>'withdrawn'" and then make them appear and disappear with "$TL->state('normal')" and "$TL->state('withdrawn')". this way, you only have to deal with the two actual widgets (presuming you don't want sets of them to appear, eg. two progress bars, three progress bars at once) and the amount of memory consumed will remain stable. That may even solve the problem.
Re^2: Modifying Tk widgets via references
by Eric (Initiate) on Mar 17, 2008 at 21:38 UTC
|
Thanks for the hint,
yes, ultimately, I will simply withdraw/show the widgets until that part of the programme is finished. The destroy part was more or less an easy thing to do as a proof of concept.
If I can't find a better solution, I will probably have to create dedicated widgets for each instance, but that somehow seems to be a very clumsy way of doing it and I was hoping to simplify the code by re-using the widget calls.
| [reply] |
|