in reply to TK: adding notebook tabs dynamically
I'm trying to add tabs to a notebook dynamically while the program is running, after MainLoop has started.
Here, the first 20 tabs are added fine, as MainLoop hasn't started yet, but the later tabs don't show up.# silly toy example use strict; use Tk; use Tk::NoteBook; my $i=0; my $top = MainWindow->new( ); my $nb = $top->NoteBook(); $top->repeat(200, \&add_tab); &add_tab() for 1 .. 20; MainLoop(); sub add_tab { exit if $i>50; $i++; print "adding tab $i\n"; my $tab = $nb->add($i, -label => $i ); $nb->pack; }
Without destroying and rebuilding the entire top window, how can I add a tab to a notebook after MainLoop has started?
Thanks!
20041011 ysth Reparented under later duplicate
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TK: adding notebook tabs dynamically
by tachyon (Chancellor) on Oct 11, 2004 at 03:04 UTC |