Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: TK: adding notebook tabs dynamically

by water (Deacon)
on Oct 11, 2004 at 03:51 UTC ( [id://398094]=note: print w/replies, xml ) Need Help??


in reply to Re: TK: adding notebook tabs dynamically
in thread TK: adding notebook tabs dynamically

Dynatabframe sounds great.

I am having trouble getting it to work (XP, activestate).

Am I / how am I using it wrong? Thanks for the help!

use strict; use Tk; use Tk::DynaTabFrame; my @tab; my $top = MainWindow->new(); my $nb = $top->DynaTabFrame; &add_tab() for 1 .. 6; $nb->pack; MainLoop(); my $i = 0; sub add_tab { $i++; print "adding tab $i\n"; $tab[$i] = $nb->add( -caption => 'Tab label' . $i, -tabcolor => 'black', ); $tab[$i]->Label( -text => 'dsdss' ); }

Replies are listed 'Best First'.
Re^3: TK: adding notebook tabs dynamically
by zentara (Archbishop) on Oct 11, 2004 at 16:17 UTC
    You have a really bad placement of your my $i = 0 line. But the reason your code dosn't work is you need to pack in the sub.
    #!/usr/bin/perl use warnings; use strict; use Tk; use Tk::DynaTabFrame; my @tab; my $top = MainWindow->new(); my $nb = $top->DynaTabFrame->pack; my $i = 0; for(1..6){ &add_tab()}; MainLoop(); sub add_tab { $i++; print "adding tab $i\n"; $tab[$i] = $nb->add( -caption => 'Tab label' . $i, -tabcolor => 'black', )->pack; $tab[$i]->Label( -text => 'dsdss' )->pack; }

    I'm not really a human, but I play one on earth. flash japh
Re^3: TK: adding notebook tabs dynamically
by aquarium (Curate) on Oct 11, 2004 at 10:47 UTC
    Personally i have found tixnotebook much easier to use. i had similar/same problem with update of the notebook using tknotebook. in tixnotebook you can also color the background of each tab, have soft or sharp corners etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://398094]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found