On 01/09/2009 9:13 PM, Michael Carman wrote:
Having created a fork of Tkx to play with, I'm starting to experiment with duplicating some of the functionality that Perl/Tk has in Tk::mega. The first item on my list is support for class initialization. The Tk::mega documentation says thatClassInit is called once for each MainWindow just before the first widget instance of a class is created in the widget tree of MainWindow. As Perl/Tk supports multiple mainwindows, ClassInit could be called more than once. 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.
I think it has already been clarified, but what you likely really want is multiple toplevels, not multiple interpreters. You can do some fancy stuff with the multiple interps (and I have in tkcon and the Tcl/Tk browser plugin), but that's rarely something end user programmers would expect to use.
Instead of new interps, just create new toplevels (Tkx::toplevel(...)), as many as you want. More complex interfaces can have a dozen on the screen at once (though I'd encourage against from a UX pov).
As for why Tkx behaves the way it does - this is because it is simplified to say "you really only want one interp" and gives you the main windows for that one interp. I wouldn't change this without more convincing for special cases.
Jeff
