> From: Michael Carman [mailto:mjcar...@mchsi.com] 
> Does Tkx (or perhaps it would be Tcl.pm) support multiple mainwindows?
> This doesn't complain, but even though $x and $y have different
> addresses they refer to the same Tk widget.
> 
>     my $x = Tkx::widget->new('.');
>     my $y = Tkx::widget->new('.');
> 
> That's not surprising since they have the same name. Methods like
> _parent() and _kid() exploit this to "retrieve" the widget reference
> from the Tcl name. Giving $x and $y different Tcl names doesn't appear
> to be an option, either. Most of my attempts ended in "bad window path
> name" errors. While there are lots of examples of using '.' 
> as the name
> of the root window and it appears to be a requirement, the 
> documentation
> never actually explains it.
> 
> 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.

With tk-enabled Tcl.pm you could do

my $interp2 = $interp1->interp('create');
and have another mainwindow for $interp2.

As it seems to me, the Tkx package creates only one tcl interpreter within 
Tkx::i package and does not expose it to the user. So it seems to me that 
seconf interpreter is not possible for Tkx, but could be possible with a minor 
modifications to Tkx.

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...

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!

Best regards,
Vadim.

Reply via email to