Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Modifying Tk widgets via references

by my_nihilist (Sexton)
on Mar 17, 2008 at 21:29 UTC ( #674654=note: print w/replies, xml ) Need Help??

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.
  • Comment on Re: Modifying Tk widgets via references

Replies are listed 'Best First'.
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://674654]
[jedikaiti]: Also...
[jedikaiti]: Interstellar Shiney!
[LanX]: an artistís impression ...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-11-22 16:42 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (327 votes). Check out past polls.