in reply to Re: Re: Re: Syntax error using Tk
in thread Syntax error using Tk
I want to make it so the buttons will expand to fill the frame, so when thw window is resized the buttons will resize accordingly. Is this possible??my $mw = new MainWindow(-title => 'Calc', -bg => 'blue'); $mw->geometry("300x300"); my $topframe = $mw->Frame(-height => '60', -width => '300', -bg => 'bl +ack'); my $btmframe = $mw->Frame(-height => '225', -width => '300', -bg => 'r +ed'); my $display = $topframe->Entry(-justify => 'right', -state => 'disabled', -textvariable => \$calc) ->pack(-expand => '1', -fill => 'x', -pady => 30, -padx => 20, -side => 'right'); $mw->bind("<KeyRelease>" , sub { &keypress } ); for my $i ( qw/ 7 8 9 4 5 6 1 2 3 0 . C / ) { $button{$i} = $btmframe->Button(-text => "$i", -width => '3', -height => '1', -command => sub { &btnpress($i) }) ->grid(-row => $row, -column => $column, -padx => 2, -pady => 2, -sticky => 'nsew', -ipadx => 10, -ipady => 10); $column++; if($column > 2){$column = 0; $row++;} } $topframe->pack(-side => 'top', -expand => '0', -fill => 'x'); $btmframe->pack(-side => 'top', -expand => '1', -fill => 'both'); MainLoop;
Nollaig shona duit.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Syntax error using Tk
by JamesNC (Chaplain) on Feb 18, 2004 at 03:39 UTC | |
by eoin (Monk) on Feb 18, 2004 at 12:19 UTC | |
by JamesNC (Chaplain) on Feb 18, 2004 at 16:03 UTC |