________________________________

        From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Daniel Burgaud
        Sent: Thursday, September 20, 2007 14:49
        To: perl-win32-users@listserv.activestate.com
        Subject: PerlTk: problem with notebook and canvas
        
        
        Hi,
        
        Is it possible to create "Notebooks" of Canvas?
        
        use Tk;
        require Tk::BrowseEntry;
        require Tk::ROText;
        require Tk::NoteBook;
        
        my $mw = MainWindow->new( -bg => "#000000" ); 
        $frames{main}    =
$mw->NoteBook(-relief=>'flat',-border=>1,-tabpadx=>1,-tabpady=>1,-font=>
[-family=>"Tahoma",-size=>8],-bg=>'#404040',-foreground=>'#FFFFFF',-inac
tivebackground=>"#808080")->pack(-expand => 1,-fill => 'both',-side =>
'top'); 
        
        foreach my $pair (qw/Pair1 Pair2 Pair3 Pair4 Pair5/) {
            $frames{tab}{$pair}    = $frames{main}->add($pair,
-label=>$pair);
            $frames{canvas}{$pair}    = $frames{tab}{$pair}->Canvas(
-width => 400, -height => 635, -background => 'black',)->pack(-side =>
'top'); 
        }
        $charts{$pair}{grid}{$price} =
$frames{canvas}{$pair}->createLine(0,50,615,50, -fill => "#404040");
        
        Compiles ok, but the last code keeps giving me this error:
        Can't call method "createLine" on an undefined value at chart.pl
line 105.
        
        If I remove the "Notebook" codes the script runs ok.
        
        What I wanted to do is create a TK, create notebooks and each of
these "tabs" are canvases where I draw charts.
        
        thanks
        Dan
         
        I don't do that much tk, but here is yours with what you gave
and using strict/warnings. I alos created the frames with a different
color for each. Like I said, I don't have a real understanding of tk,
but it is part of Perl, so here is simple start and others can give me
insight.
        #!perl
         
        use strict;
        use warnings;
         
        use Tk;
        require Tk::BrowseEntry;
        require Tk::ROText;
        require Tk::NoteBook;
        my %frames = ();
        my %charts = ();
        my $pair;
         
        my $MyIdx = 0;
        my @MyColor = qw(green red blue yellow white);
         
        my $mw = MainWindow->new( -bg => "#000000" ); 
        $frames{main}    =
$mw->NoteBook(-relief=>'flat',-border=>1,-tabpadx=>1,-tabpady=>1,-font=>
[-family=>"Tahoma",-size=>8],-bg=>'#404040',-foreground=>'#FFFFFF',-inac
tivebackground=>"#808080")->pack(-expand => 1,-fill => 'both',-side =>
'top'); 
        foreach $pair (qw/Pair1 Pair2 Pair3 Pair4 Pair5/) {
            
            $frames{tab}{$pair}    = $frames{main}->add($pair,
-label=>$pair);
            $frames{canvas}{$pair}    = $frames{tab}{$pair}->Canvas(
-width => 400, -height => 635, -background =>
$MyColor[$MyIdx++],)->pack(-side => 'top'); 
            $charts{$pair}{grid}{$pair} =
$frames{canvas}{$pair}->createLine(0,50,615,50, -fill => "#404040");
        }
        MainLoop; 
        


**********************************************************************
This message contains information that is confidential and proprietary to FedEx 
Freight or its affiliates.  It is intended only for the recipient named and for 
the express  purpose(s) described therein.  Any other use is prohibited.
**********************************************************************

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to