on Thu, 18 Apr 2002 23:36:16 GMT, [EMAIL PROTECTED] (James Taylor) wrote:

> 
> For example, I would have a
> program that does something like:
> 
> for (1 .. 10) {
>    print "$_\n";
> }
> 
> Well, I need to print that into the canvas in TK.  How the hell do I
> do this?! It seems like something so trivial, yet not even the
> Perl/TK tutorial talks about something as simple as this.

You could use the following (very rudimentary) method:

        #! /usr/bin/perl -w
        use strict;

        use Tk;
        
        my $message = << "EOM";
        This is a text line.
        This is another.
        ...
        This is the last.
        EOM

        my $mw = MainWindow->new;
        $mw->title("The window title");
        my $text = $mw->Scrolled("Text", -scrollbars=>"osoe")->pack();  
        $text->insert('end',$message); 
        $mw->Button(-text => "Close", -command => sub { exit })->pack();
        
        MainLoop;

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to