> FYI - My GUI is relatively simple, and I find that vtcl 1.6.1
> is prety
I came to VTCL design that no more opens...
However, using VTCL at start is very fruitful for novices, who not familiar
with geometries and starting with Tk.
> > 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.
> >
>
> Hey that would be fantastic!
that's simple: I've just copy-pasted code from Tk::Text and it works.
Here is full working program:
sub Tcl::Tk::Widget::Text::TIEHANDLE
{
my ($class,$obj) = @_;
return $obj;
}
sub Tcl::Tk::Widget::Text::PRINT
{
my $w = shift;
# Find out whether 'end' is displayed at the moment
# Retrieve the position of the bottom of the window as
# a fraction of the entire contents of the Text widget
my $yview = ($w->yview)[1];
# If $yview is 1.0 this means that 'end' is visible in the window
my $update = 0;
$update = 1 if $yview == 1.0;
# Loop over all input strings
while (@_)
{
$w->insert('end',shift);
}
# Move the window to see the end of the text if required
$w->see('end') if $update;
}
sub Tcl::Tk::Widget::Text::PRINTF
{
my $w = shift;
$w->PRINT(sprintf(shift,@_));
}
use Tcl::Tk;
my $int = new Tcl::Tk;
my $mw = $int->mainwindow;
my $text = $mw->Text->pack;
tie *STDOUT, ref $text, $text;
print "Hello World";
$int->MainLoop;
You can paste that text into proper file, and here you go!
BR,
Vadim.