[Edu-sig] re: Pygeo, platforms, wx and Tk

Arthur ajsiegel at optonline.net
Wed Dec 15 05:05:04 CET 2004


>And I *do* face a crucial functional issue with TK, and only on Linux, as
>it happens, regarding threading.

>I may try to present the issue later, to try to get some feedback, and
>help determine whether the issue is inherent, a limitation of the
>developer, or a limitation of the particular toolkit.

Here goes:

So I have 2 windows - one is a Display for the VPython rendering and is
actually constructed as a class derived from the VPython display object
(native on Windows, GTK1 on linux) The other is a TK control panel.

The user can interact with either - pick and move points, for example, in
the Display, or reveal or hide construction levels from the control Panel.
So each must be in a loop, and the 2 windows need to be able to communicate
with to each other as to any user action.

On Windows, in the Display class I create the Panel, sending the Display as
one of the arguments, while saving a reference to the Panel as an attribute
of the Display class.  And start a thread that sets off the TK loop for the
Panel. The Display now has a reference to the Panel set on its creation, and
the Panel now has a reference to the Display, sent to it as an argument.
And the communication is bi-directional, via these references.

Same tact on Linux produces an error something to the effect:

"Attempt to start TK instance from a separate appartment" (definitely
spelled with 2 p's).

A search on this error message on python-list brings me to a post by Aahz,
resident threading expert, asking why one would want to multi-thread a TK
application. Implying, I think, that one can't.

I am not sure that I need to.  Or mean to. But nonetheless I can't find an
approach here that yields bi-directional messaging other than the one that
works on Windows.

This is sounding both esoteric, and not well described. But I am not so much
expecting as answer, as much as anyone's gut as to whether this is
answerable, and whether my problem is in any way TK specific.

Thanks.

Art





More information about the Edu-sig mailing list