momo33 has asked for the wisdom of the Perl Monks concerning the following question:
This produces: http://img199.imageshack.us/img199/9596/scrolltest.png A straight conversion to Tkx looks like this:use Tk; use Tk::HList; use Tk::LabFrame; my $mw = MainWindow->new; my $gui_period_f = $mw->LabFrame( -label => "report month", -labelside => 'acrosstop', -relief => 'groove', -borderwidth => '5' ); my $b_period = $gui_period_f->Button( -text => "change year", -command => sub { &do_select_period }, -foreground => 'darkgrey' ); my $gui_period = $gui_period_f->Scrolled( qw/HList -background grey -scrollbars se -height 5 -width 35/ ); # $gui_period->bind( '<ButtonRelease-1>' => \&show_period ); $gui_period->configure( -selectmode => 'single' ); $gui_period->configure( -browsecmd => \&show_period ); $gui_period->configure( -separator => '+' ); $gui_period_f->grid( -row => 1, -column => 0, -rowspan => 2, -sticky => 'nsew' ); $b_period->grid( -row => 1, -column => 0, -rowspan => 1, -sticky => 'nsew' ); $gui_period->grid( -row => 2, -column => 0, -rowspan => 1, -sticky => 'nsew' ); MainLoop;
The resulting image: http://img194.imageshack.us/img194/503/scrolltesttkx.png Can someone tell me how to attach scrollbars with Tkx 'the right way'? Thank you alluse Tkx; my $mw = Tkx::widget->new("."); my $gui_period_f = $mw->new_ttk__labelframe( -text => "report period", -labelanchor => 'ne', -relief => 'groove', -borderwidth => '5' ); my $b_period = $gui_period_f->new_ttk__button( -text => "change year", -command => sub { &do_select_period() }, #-foreground => $dark ); my $gui_period = $gui_period_f->new_ttk__treeview( #-background => 'grey', -height => 5, # -width => 35 ); my $gui_period_sbv = $mw->new_ttk__scrollbar( -command => [ $gui_period, "yview" ], -orient => "vertical" ); my $gui_period_sbh = $mw->new_ttk__scrollbar( -command => [ $gui_period, "xview" ], -orient => "horizontal" ); $gui_period->configure( -yscrollcommand => [ $gui_period_sbv, "set" ] +); $gui_period->configure( -xscrollcommand => [ $gui_period_sbh, "set" ] +); $gui_period_f->g_grid( -row => 1, -column => 0, -rowspan => 3, -columnspan => 2, -sticky => 'nwes' ); $b_period->g_grid( -row => 1, -column => 0, -sticky => 'nwes' ); $gui_period->g_grid( -row => 2, -column => 0, -sticky => 'nwes' ); $gui_period_sbv->g_grid( -row => 2, -column => 1, -sticky => 'ns' ); $gui_period_sbh->g_grid( -row => 3, -column => 0, -sticky => 'we' ); Tkx::MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tkx grid problem
by Anonymous Monk on Jul 04, 2009 at 12:28 UTC | |
by momo33 (Beadle) on Jul 06, 2009 at 05:54 UTC | |
|
Re: Tkx grid problem
by Anonymous Monk on Jul 04, 2009 at 11:05 UTC |