Beefy Boxes and Bandwidth Generously Provided by pair Networks httptech
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Delaying changes to widget layout with Perl/Tk

by merrymonk (Friar)
on Sep 21, 2007 at 08:17 UTC ( #640299=perlquestion: print w/ replies, xml ) Need Help??
merrymonk has asked for the wisdom of the Perl Monks concerning the following question:

I have a GUI built using the grid method to place the widgets.
I make changes to the GUI depending on user selections that remove (i.e. make invisible)
and reinstate other widgets. Is there a way of ‘freezing’ the GUI (that is preventing the effect
that is obtained by wg->update) until all the work to make the changes has been done?

Comment on Delaying changes to widget layout with Perl/Tk
Re: Delaying changes to widget layout with Perl/Tk
by strat (Canon) on Sep 21, 2007 at 08:35 UTC

    Are $mw->Busy; at the beginning and $mw->Unbusy; at the end of the rearrangement enough?

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

      Thanks for that suggestion.
      However, perhaps not.
      I just tried by adding $mw->Busy but the GUI was updated.
      Should this have happened?
Re: Delaying changes to widget layout with Perl/Tk
by zentara (Archbishop) on Sep 21, 2007 at 17:16 UTC
    You can withdraw the $mw while reconfiguring it, and pop up a "please wait" toplevel, something like below. Otherwise, you can packForget all the widgets, rebuild them without packing, then pack them all at once.
    #!/usr/bin/perl use warnings; use strict; use Tk; my $config; my $mw = MainWindow->new(-title=>"Demo"); $mw->withdraw; get_config($mw); MainLoop; sub setup_mw{ my $label = $mw->Label(-text=> $config)->pack(); $mw->deiconify; $mw->raise; } sub get_config { my $parent = shift; #collect your config here $config = 'hoohah'; my $win = $parent->Toplevel(-title=>'config window'); my $Bttn = $win->Button( -text=>"I'm done configuring, so press me", -command=> sub{ $win->destroy; setup_mw(); } )->pack( ); } __END__

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      I would prefer not to minimise the GUI.
      I am using the grid method to place the widgets.
      Is there a way I can set the grid values but then make
      these effective (so that the new form of the GUI
      is obtained) at one go?
        I use pack almost exclusively, but have you read "perldoc Tk::grid" ? There is gridForget and gridPropagate, etc, so you should be able to find a way.

        I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://640299]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-04-18 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (460 votes), past polls