in reply to TK Geometry question.
I would start with
See Re^3: resizing problem with Tk appl using PackForget, Tk::Scrolled, (inside Tk::Wm sub Scrolled), inside Tk::Frame sub packscrollbars, Tk::WidgetDump, and start with
#!/usr/bin/perl -- #~ #~ perltidy -olq -csc -csci=3 -cscl="sub : BEGIN END " -otr -opr -ce + -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use Tk qw/ tkinit /; Main( @ARGV ); exit( 0 ); sub Main { my $mw = TkMain( @_ ); $mw->WidgetDump; ## use Tk::WidgetDump; $mw->MainLoop; } ## end sub Main sub TkMain { my $mw = tkinit( -bg => 'green', ); $mw->minsize( 60, 60 ); my $top = $mw->Pane( -bg => 'orange', )->pack( -side => 'top', -expand => 0, -fill => 'x', ); my $label = $top->Label( -text => 'Label', -bg => 'pink', )->pack( qw/ -side left / ); my $cans = $mw->Scrolled( Frame => -bg => 'white', )->pack( -fill => 'both', -expand => 1, ); my $can = $cans->Canvas( -width => 300, -height => 300, -bg => 'pink', )->pack( -fill => 'none', -expand => 0, ); $top->Button( -text => 'packscrollbars', -command => [ \&unforgetScrollbars, $cans ], )->pack( qw/ -side left / ); $top->Button( -text => 'packForget scrollbars', -command => [ \&forgetSrollbars, $cans ], )->pack( qw/ -side left / ); #~ $mw->bind( '<Configure>' => [ \&gotResized , $cans ] ) ; ## too + much $mw->bind( $cans, '<Configure>' => \&gotResized ); ## *ok* ## http://www.tcl.tk/man/tcl8.4/TkCmd/bind.htm $cans->Subwidget( 'xscrollbar' )->bind( '<Configure>', \&gotResize +d ) ; ## bingo? ## $xscrollbar->parent->.... return $mw; } ## end sub TkMain sub gotResized { warn "@_"; my( $cans ) = @_; } ## end sub gotResized sub unforgetScrollbars { my( $cans ) = @_; $cans->Subwidget( 'ysbslice' )->pack; $cans->Subwidget( 'corner' )->pack; $cans->Subwidget( 'yscrollbar' )->pack; $cans->Subwidget( 'xscrollbar' )->pack; $cans->packscrollbars; } ## end sub unforgetScrollbars sub forgetSrollbars { my( $cans ) = @_; $cans->Subwidget( 'ysbslice' )->packForget; #~ $cans->Subwidget( 'corner' )->packForget; $cans->Subwidget( 'yscrollbar' )->packForget; $cans->Subwidget( 'xscrollbar' )->packForget; } ## end sub forgetSrollbars __END__
|
|---|