Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^7: Tk::grid -sticky option not stretching frames

by zentara (Archbishop)
on Nov 15, 2018 at 13:19 UTC ( #1225856=note: print w/replies, xml ) Need Help??

in reply to Re^6: Tk::grid -sticky option not stretching frames
in thread Tk::grid -sticky option not stretching frames

Hi, I'm glad I could help you. To go further, in my previous reply I suggested for responsiveness, try to stick to one widget, like the canvas. If you go and try to add 1000 OptionMenus to the Canvas, it will quite possibly slow things up, because all those extra widgets need event handling. There is a good solution though, by popping up toplevel windows to handle your OptionMenus. So in the example I gave, you would add a right-click binding to each active area, when the right-click is processed, it pops open a separate toplevel window containing your OptionMenu. You load the OptionMenu dynamically from a big hash of data. Then REUSE the OptionMenu by deleting all it's current options, and reloading it when it needs to be used again. So, the overall idea is to make a single reusable toplevel window ( or popup ), with a single reusable OptionMenu, which you dynamically reconfigure with appropriate data on each use. This way, you stay responsive, AND MORE IMPORTANTLY, you don't start getting unwanted memory gains from repeated toplevel creations. Always think in terms of reusing widgets if possible, as that keeps the memory footprint under control.

As a quick example, here is a reusable toplevel that you could use. See Re: opening multiple sub-windows in perl tk

I'm not really a human, but I play one on earth. ..... an animated JAPH
  • Comment on Re^7: Tk::grid -sticky option not stretching frames

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2022-10-07 06:09 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (29 votes). Check out past polls.