Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Refreshing top level after geometry changes

by Kafka (Acolyte)
on Dec 07, 2014 at 12:05 UTC ( [id://1109479]=perlquestion: print w/replies, xml ) Need Help??

Kafka has asked for the wisdom of the Perl Monks concerning the following question:

Hello dear monks, My problem is very simple: I have a top level which I add a new Scrolled widget upon pressing of a button. I use the grid manager, and I want the new Scrolled widget to be posted just below the current layout. It all works fine except that the geometry of the top level does not refresh to show the new widget. If I change the size of the window manually I can see the new widget. Help please
  • Comment on Refreshing top level after geometry changes

Replies are listed 'Best First'.
Re: Refreshing top level after geometry changes
by ww (Archbishop) on Dec 07, 2014 at 12:35 UTC

    Code?



    Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
    1. code
    2. verbatim error and/or warning messages
    3. a coherent explanation of what "doesn't work actually means.
      Hi, I don't want to change the geometry. I expect the window to automatically resize/refresh contents when a new widget is invoked. When the button is pressed, the new widget is created just below the button, but unless I resize the top level it can't be seen. Maybe some code can help:
      sub manage_dirtree { my $TOP = shift; my $create_ref = shift; my $dir_but = shift; my $dir_frame = shift; my $blks_box; my $i; my @files_list; if ($$create_ref) { $$dir_frame = $TOP->Frame(-borderwidth => 2 , -relief => 'groo +ve') ->grid(-row=>9,-column=>0,-columnspan=>4,-sticky=>'we'); $$dir_frame->gridColumnconfigure(1, -weight => 1); my $d = $$dir_frame->Scrolled('DirTree', -label=>'Choose Directory', -scrollbars => 'se', -width => 25, -height => 18, -selectmode => 'browse', -exportselection =>1, -command => sub { }, )->grid(-column=>0,-row=>0,-sticky=>'ew',-columnspan=>2); $blks_box = $$dir_frame->Scrolled('Frame', -scrollbars=>'oe', -label=>'Blocks in Dir.' )->grid(-column=>2,-columnspan=>2,-row=>0,-sticky=>'news'); $dir_but->configure(-text=>'Hide Directories'); } else { $$dir_frame->destroy; $dir_but->configure(-text=>'Add Directory'); } $$create_ref = !$$create_ref; }
      And here is the button:
      $add_dir_button = $bottom_frame->Button(-text=>"Add direct +ory", -command=>sub { manage_d +irtree($TOP,\$create,$add_dir_button,\$dir_frame); } )->grid(-row=>0,-column=>2,-colu +mnspan=>2,-sticky=>'e');
Re: Refreshing top level after geometry changes
by Discipulus (Canon) on Dec 07, 2014 at 21:08 UTC
    Hello Kafka presenting a better question (this is not the question, agent spooner..) quite always bring you better answers. Otherway you can reread carefully the docs of Tk geometry manager, or search the monastery or the web for examples. I have done only few things wit Tk but i created many positioned windows (maybe i miss your question, btw) in my Tartaglia's triangle fun.
    Search for construction of the triangle windows in the
    sub draw_triangle { .. $tart_win->geometry("300x450+708+0");

    HtH
    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Refreshing top level after geometry changes
by Khen1950fx (Canon) on Dec 07, 2014 at 22:30 UTC
Re: Refreshing top level after geometry changes
by Anonymous Monk on Dec 07, 2014 at 23:49 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-20 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found