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

Kent Johnson kent37 at tds.net
Wed Dec 15 12:10:32 CET 2004


Arthur wrote:
> 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.

I don't understand what the loop is doing. It sounds like you are polling the panel for changes 
instead of using event callbacks and the GUI event loop.

Maybe you know this - normally in a GUI application you register callback handlers with the widgets 
in the gui. So when a field changes a handler function is called to do whatever you want. No 
explicit loop is needed.

You certainly should be able to create a GUI app with two panels that respond to user input without 
explicitly creating any threads.

HTH
Kent

> 
> 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
> 
> 
> 
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
> 


More information about the Edu-sig mailing list