shortyfw06 has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to add a scrollbar to this frame. I can't seem to figure out how to get this to work properly. Here is an example of one attempt.
#!/usr/bin/perl use warnings; use strict; use Tk; use Cwd; ###################################################################### +##################### # GUI Building ###################################################################### +##################### # make the selections available to the print_input_values sub my %t; my %mat; my %ort; my %mat_lab; my $scr; # Create Main Window my $mw = new MainWindow; my $lam_num; my $row=1; my $column=1; my $lam_mat_frm = $mw -> Frame(); $lam_mat_frm->grid(-row=>$row, -column=>$column,-columnspan=>6); my $lam_num_lab = $lam_mat_frm -> Label(-text=>"Input the number of pl +ies in the laminate.", -font=>"ansi 10 bold"); $lam_num_lab->grid(-row=>$row, -column=>$column); $column++; my $lam_num_ent = $lam_mat_frm -> Entry(-textvariable=> \$lam_num); $lam_num_ent->grid(-row=>$row, -column=>$column); $column++; my $lam_data_button = $lam_mat_frm->Button(-text=>"Input Laminate Data +", -command=> \&input_lam_data); $lam_data_button->grid(-row=>$row, -column=>$column); $column++; my $reset_button = $lam_mat_frm->Button(-text=>"Reset", -command=> \&do_reset); $reset_button->grid(-row=>$row, -column=>$column); $row++; my $lam_frm = $mw -> Frame(); $lam_frm->grid(-row=>$row,-column=>$column,-columnspan=>6); MainLoop; sub do_reset { $lam_num_ent->delete(0,'end'); $lam_frm->packForget; $row=2; $column=4; $lam_frm = $mw -> Frame(); $lam_frm->grid(-row=>$row,-column=>$column,-columnspan=>6); } sub input_lam_data { $row=4; $column=2; my $scrollbar = $lam_frm->Scrollbar(); $scrollbar->grid(-row => 1, -column => 5); my @lam_mat_t_lab = ( 'Material', 'Thickness', 'Orientation', ); my @mats = ("PW","8HS","Tape"); my %mat_optmen; my $n = 1; $row=5; $column=2; do { $mat_optmen{$n} = $lam_frm -> Optionmenu(-options => \@mats, -variable => \$mat{$n}); $mat_optmen{$n}->configure(-yscrollcommand=>['set',$scrollbar] +); $mat_optmen{$n}->grid(-row=>$row,-column=>$column); $scrollbar->configure(-command=>['yview'=>$mat_optmen{$n}]); $row=$row+1; $n = $n + 1; } until ($n == $lam_num+1); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Scrollbar in Frame
by zentara (Archbishop) on Sep 06, 2012 at 10:17 UTC | |
Re: Scrollbar in Frame
by Anonymous Monk on Sep 05, 2012 at 23:39 UTC |
Back to
Seekers of Perl Wisdom