Tkinter vs wxPython: your opinions?

Vadim Zeitlin zeitlin at seth.lpthe.jussieu.fr
Mon Jan 29 10:07:35 EST 2001


On Mon, 29 Jan 2001 02:49:46 GMT, thelazydogsback at my-deja.com <thelazydogsback at my-deja.com> wrote:
>(1) Does one toolkit behave better in a multi-threaded application than
>another? In addition to the design of the toolkit, any kit that uses
>native widgets has native restrictions on threading and the GUI (e.g.,
>only "main" thread talks to the GUI, etc.), so I'd guess that self-draw
>GUIs would have a chance of behaving better here.

 At least for Windows, this is not true as any toolkit is going to use GDI
calls (at least tkInter surely does, it might be possible to use DirectX or
whatever instead, but I don't think it's a good idea for a GUI toolkit) and
the usual restrictions about multiple GUI threads come from GDI layer, so you
gain nothing here.

>When threads spawned from the main thread
>need to update GUI state, what is the standard method used?

 In wxWindows you may either:

1. set a global variable (protected by a critical section) from the worker
   thread and check it in the main thread during the next idle loop iteration

or

2. use wxPostEvent() to send a (custom) event to the main GUI thread which
   will then get it some time later

> Does wx's doc/view architecture make this more straightforward?

 No, it predates the threads support by about 5 years so I don't think so.

>(2) I assume I could have an app the used both wx & tk at the window
>level,

 Assuming you can share the message loop between them...

> but is it possible to host WX inside of Tk, or visa-versa, at
> the frame and/or widget level?

 It should be possible to embed Tk in a C++ application in the "usual" way but
I don't know much about it. OTOH embedding wxWin into Tk application is
probably quite hard to do.

 Regards,
VZ

-- 
GCS/GM d? H+ s++:-- p2 au--- a- w+ v C+++ UBLS+++ P- L++ N++ E--- W++++ M? V--
-po+ R++ G`` !tv b+++ D--- e++++ u++ h--- f+ r++ n- y?



More information about the Python-list mailing list