Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Modifying Tk widgets via references

by my_nihilist (Sexton)
on Mar 17, 2008 at 21:29 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://674654]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found