Konovalov, Vadim (Vadim)** CTR ** wrote:
>> From: Michael Carman [mailto:[email protected]] It looks like
>> multiple mainwindows are not possible, in which case I can safely
>> ignore that aspect of the Tk behavior. Is this true?
>
> In my vision, in tcl/tk world there is only one mainwindow (a
> toplevel with path '.'), but this is per interpreter.
One mainwindow per interpreter makes sense.
> So it seems to me that seconf interpreter is not possible for Tkx,
> but could be possible with a minor modifications to Tkx.
It wasn't a recommendation. :O
> On the contrary, in Tcl::Tk any widget has "interp" method, which
> gives you an instance to widget's interpreter, so it is possible to
> create another one, but I never used that feature, may be it is never
> needed...
I've never needed multiple mainwindows, but there must have been a use
case for Perl/Tk to go to the trouble of supporting it.
> Which makes me wonder - is my understanding true, that in Tkx a user
> is not allowed to do tcl/tk's evals? IMO, this is a really nice
> feature! Really powerful!
Tkx doesn't expose the interpreter directly but you can use it via
Tkx::eval(). It's definitely a powerful feature -- Tkx::ROText wouldn't
be possible without it.
Per the previous thread on callback syntax, you could get at the
interpreter this way
#!/usr/bin/perl
use strict;
use warnings;
use Tkx;
my $interp;
my $mw = Tkx::widget->new('.');
my $button = $mw->new_button(
-command => sub { $interp = $_[1] }, # Bwahaha
);
$button->invoke();
$button->g_destroy();
print $interp;
__END__
Tcl=SCALAR(0x35b2efc)
But that's undocumented and looks like it's going away (which is good).
-mjc