[pygtk] pyGTK on Windows

Jeff Bowden jlb at houseofdistraction.com
Wed Feb 4 13:10:27 WST 2004


John K Luebs wrote:

>On Tue, Feb 03, 2004 at 08:33:11PM -0500, Dave Aitel wrote:
>  
>
>>Is there a known bug, possibly related to threading (I just thread 
>>enabled by app), that turns the fonts to white on white, in pyGTK 
>>(latest python and pyGTK) on Windows XP?
>>    
>>
>
>Probably not related to the topic of this thread, but important for
>would be multi threaders on Windows. It is almost not possible to
>use multiple threads safely with gtk on Windows, even if you lock
>properly. Xlib doesn't care about threads, as long as you serialize your
>calls properly. Windows is fundamentally different. When you create a
>window, the window is married to the thread that called CreateWindow.
>This means it is impossible to use gtk/gdk from different threads even
>if you lock properly without looking under the gdk hood to see if the
>underlying Win32 API calls are "safe". You gotta love Windows. As has
>been discussed on the gtk-devel list a solution is to have GDK create a
>single thread dedicated to Window creation, and have functions post
>thread messages to this thread. This would not be trivial to implement.
>

For general threading this is true, but most GUI threading can be 
reduced to background "producer" threads which feed results to a 
designated GUI "consumer" thread via a python Queue object.  This sort 
of architecture is often easier to understand and debug than ad-hoc 
threading.




More information about the pygtk mailing list