Another related question: how do I get the initial size to be just large enough so that there are not scroll bars needed? So, for the sample in the last post, how would I get it so the window is initially large enough to show all the (400) buttons?
-----Original Message----- From: Swingle David-QWHM86 Sent: Tuesday, March 02, 2010 6:34 PM To: Jeff Hobbs Cc: tcltk@perl.org Subject: RE: Scrolling a window Oh, that works. Thanks! I must have had it wrong, but that was several edit cycles ago so I can't see what I had :) -----Original Message----- From: Jeff Hobbs [mailto:je...@activestate.com] Sent: Tuesday, March 02, 2010 6:25 PM To: Swingle David-QWHM86 Cc: tcltk@perl.org Subject: Re: Scrolling a window BWidget ScrollableFrame http://docs.activestate.com/activetcl/8.5/bwidget/ScrollableFrame.html Example rewritten to use grid. use strict; use Tkx; Tkx::package_require("BWidget"); my $mw = Tkx::widget->new("."); my $sw = $mw->new_ScrolledWindow(); my $sf = $sw->new_ScrollableFrame(); $sw->setwidget($sf); #$sw->g_pack(-fill => "both", -expand => 1); $sw->g_grid(-sticky => "nsew"); # In Tk 8.4, you must use '0' instead of $sw below. Tk 8.5 will find # the row/col based on widget reference Tkx::grid(rowconfigure => $mw, $sw, -weight => 1); Tkx::grid(columnconfigure => $mw, $sw, -weight => 1); my $subf = Tkx::widget->new($sf->getframe()); my $b; for my $i (1..20) { for my $j (1..20) { $b = $subf->new_ttk__button(-text => "$i,$j", -command => sub {exit;}); $b->g_grid(-row => $i, -column => $j); } } Tkx::MainLoop; Enjoy, Jeff