in reply to Problem with scrolling Tk Table
Put the Table (non-scrolled) into a Scrolled Pane. That will keep things visible. I don't know what your variable cell sizes will do in this setup, you may have to do some fancy callbacks, like reconfiguring the canvases' scrollregions after a mainwindow resize. Anyways..... think Scrolled Pane.
#!/usr/bin/perl -w use strict; use warnings; use Tk; use Tk::Table; require Tk::Pane; my $graph_width=300; my $graph_height=400; #my $graph_height=800; my $title_c; my $group; my $canvas; my $table; my @group_names=('A','B'); my $col=0; my $graph_win = MainWindow->new( ); $graph_win->withdraw; my $pane = $graph_win->Scrolled('Pane')->pack(-expand=>1,-fill=>'both' +); $table= $pane->Table( -rows => 2, -columns => 2, -scrollbars => 'e', -fixedrows => 1, -fixedcolumns => 0 )->pack( -expand => 1, -fill => 'both', ); foreach $group (@group_names){ $title_c=$table->Label( -text => $group, -relief => 'groove', -font => "{Arial} 15 bold", -borderwidth => 2, ); $table->put(0,$col, $title_c); $col++; } $col=0; foreach $group (@group_names){ $canvas = $table->Scrolled("Canvas", -scrollbars => 's', -width => 300, -height => $graph_height, -background => 'white', -borderwidth => 2, -relief => 'groove', -scrollregion => [0,0,$graph_width,$graph_height] ); $table->put(1,$col++, $canvas); } $graph_win->deiconify(); $graph_win->raise(); $graph_win->geometry('600x500+30+30'); MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with scrolling Tk Table
by tcarmeli (Beadle) on Apr 25, 2007 at 14:27 UTC | |
by zentara (Cardinal) on Apr 25, 2007 at 17:10 UTC |