momo33 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perlmonks,

I would like to have a resizable listbox in Tkx, but I cannot get it working.
The problem is that the button resizes, not the listbox. If I remove the button, the listbox resizes.
What needs to be done to resize the listbox in the vertical direction?
//careful configure was the answer//
Thank you all
#!/opt/ActivePerl-5.10/bin/perl use Tkx; $Tkx::TRACE = 64; Tkx::package_require('tile'); my $mw = Tkx::widget->new("."); my $f = $mw->new_ttk__labelframe( -text => "frame", -labelanchor => 'nw' ); my $b = $f->new_ttk__button( -text => "button", ); my $l = $f->new_tk__listbox( -height => 5, -width => 20 ); my $lv = $f->new_ttk__scrollbar( -command => [ $l, "yview" ], -orient => "vertical" ); my $lh = $f->new_ttk__scrollbar( -command => [ $l, "xview" ], -orient => "horizontal" ); $l->configure( -yscrollcommand => [ $lv, "set" ] ); $l->configure( -xscrollcommand => [ $lh, "set" ] ); $f->g_grid( -row => 0, -column => 0, -rowspan => 2, -columnspan => 2, -sticky => 'nsew' ); $f->g_grid_columnconfigure( 0, -weight => 1 ); $f->g_grid_rowconfigure( 1, -weight => 1 ); $b->g_grid( -row => 0, -column => 0, -sticky => 'ew' ); $b->g_grid_columnconfigure( 0, -weight => 1 ); $l->g_grid( -row => 1, -column => 0, -sticky => 'nsew' ); $l->g_grid_columnconfigure( 0, -weight => 1 ); $l->g_grid_rowconfigure( 1, -weight => 1 ); $lv->g_grid( -row => 1, -column => 1, -sticky => 'ns' ); $lv->g_grid_rowconfigure( 1, -weight => 1 ); $lh->g_grid( -row => 2, -column => 0, -sticky => 'ew' ); $mw->g_grid_columnconfigure( 0, -weight => 1, -minsize => 20 ); $mw->g_grid_rowconfigure( 0, -weight => 1, -minsize => 20 ); for (my $i=0; $i<10; $i++) { $l->insert("end", "$i: this is a very long line $i of 10"); } Tkx::MainLoop();

Replies are listed 'Best First'.
Re: resizable listbox in Tkx?
by Anonymous Monk on Jul 18, 2009 at 14:40 UTC
    That compiles for you? invalid command name "ttk::labelframe"
      Yep, compiles without a hitch on Debian Linux with ActivePerl-5.10...
        Hmm, I guess I need to upgrade to Tcl8.5, who knew