> I have an existing Perl application that I am being asked to 
> write a GUI
> for. My plan is to use vtcl with Tcl::Tk and its going fairly well at 
> this point.
> (See 
> http://vkonovalov.ru/vtcl-usage/Using_vtcl_for_creating_Tcl-Tk
> _GUI_for_Perl.html 
> 
> )

In general that's a good, approach, but vtcl isn't stable enough to allow this 
fully.

I tend to just do

$int->Eval(<<'EOS');
#many pure-tcl strings here
EOS

but this isn't the problem you've asked.

> 
> The existing application already outputs transcript messages to STDOUT
> and STDERR. They come from many places in the code and converting them
> all into text widget insets will be tedious. I notice that in 
> Perl's Tk
> module you can tie STDOUT to a text widget. Its nice.
> 
> use strict;
> use Tk;
> my $mw = MainWindow->new; my $text = $mw->Text(qw/ -width 40 -height 
> 10/)->pack;
> tie *STDOUT, ref $text, $text;
> print "Hello World";
> MainLoop;
> 
> I dont think I can do this with Tcl::Tk because I think its the Tk
> modules special support for the TIEHANDLE that allows it. Any
> suggestions on how I might do it?

all this special support is creating few methods in widget's package, see 
"perldoc perltie"

>     a) Maybe in raw TCL, somehow capturing the PERL 
> STOUT/STDEER streams?
>     b) Maybe intermixing Tk module with Tcl::Tk, using Tk for that one
> Text widget. But how would I connect my Tk text widget to the TCL gui?


tieing STDOUT to text widget isn't a hard task, surely this will be some 
10-line pure-perl addition.

I'll do this today or tomorrow, and let you know.

Best regards,
Vadim.

Reply via email to