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

Re: Some beginning Tk help

by dree (Monsignor)
on Jun 22, 2002 at 18:48 UTC ( #176508=note: print w/ replies, xml ) Need Help??


in reply to Some beginning Tk help

You have to bind the <Configure> event and then resize the window:

$mw->bind('<Configure>', \&Window_Resize);

This should work for you:
#!/usr/bin/perl use lib 'C:\MyPerlLib'; use Tk; use Tk::Pane; my $i = 0; my $mw = MainWindow->new( -title => "SACL Survey" ); my $pane = $mw->Scrolled(qw/Pane -scrollbars osw/)->grid(); my $label=$mw->Label( -text => "... <insert directions here> ..." )- +>grid(); for (1..30) { $pane->Radiobutton( -text => "1", -value => "1", -justify => "left", -variable => \${"rb1_q$_"}, )->grid( $pane->Radiobutton( -text => "2", -value => "2", -justify => "left", -variable => \${"rb2_q$_"}, ), $pane->Radiobutton( -text => "3", -value => "3", -justify => "left", -variable => \${"rb3_q$_"}, ), $pane->Radiobutton( -text => "4", -value => "4", -justify => "left", -variable => \${"rb4_q$_"}, )); } $mw->bind('<Configure>', \&Window_Resize); MainLoop; sub Window_Resize { my $e = $mw->XEvent; return if !$e; my $mww=$mw->width; my $mwh=$mw->height; $pane->place( -height => $mwh-30, -width => $mww-20); $label->place(-y=>$mwh-20,-x=>$mww/2-70); }


Comment on Re: Some beginning Tk help
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-07-28 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls