in reply to Tk::LabFrame and Listbox
Now your code is just a wild *ss guess. First you define $listn to be a LabFrame, then you redefine it to be a Scrolled Listbox, then you try to grid it!! You don't mix grid and pack, you must stick with one or the other. So always post working snippets, and copy&paste them in, so there are no errors.
If you are trying to put multiple scrolled Listboxes into your Labframe, you can add subframes, or a Table to your fabframe, and put listboxes into them.
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::LabFrame; my $mw = tkinit; my $lframe = $mw->LabFrame(-label=>"New", -labelside=>'acrosstop')->pack; my $listn = $lframe->Scrolled(qw/Listbox -foreground red -selectforegr +ound blue/)->pack; my @allevents =( 1..100); foreach my $key (@allevents) { $listn->insert('end', $key); } $mw->Button(-text => "Add to Listbox", -command=> sub{ $listn->insert('end', 'foobar'); $listn->see('end'); })->pack; MainLoop;
|
|---|