Running 2 gui libs simultaneously

Guido van Rossum guido at cnri.reston.va.us
Thu Jul 15 18:25:24 EDT 1999


Greg Ewing <greg.ewing at compaq.com> writes:

> Gordon McMillan wrote:
> > 
> > You don't have to use Tk's mainloop. You can call update() in a loop.
> > Perhaps wxWindows has something similar, or you can call Tk's update
> > from within some idletask in wxWindows.
> 
> I don't fancy your chances of getting that to work.
> The problem isn't just getting two main loops to
> run at the same time -- it's making sure that each
> event goes to the right UI manager.

I don't think that's the problem, at least not on Unix.  Each GUI
package has its own connection (a socket) to the X server, and the X
server knows which connection to send events to.  No different that
having two different apps.  If wxWindows exposes the socket and the
raw event handling function, you can use Tk's createfilehandler to add 
wxWindows's socket to the set of sockets on which it listens (default
only its own connection to the X server) and in the callback call
wxWindows's event handler.  Theoretically this should work fine.

> You might be able to do it by reading events
> yourself, figuring out somehow which UI they
> are meant for, and somehow passing them on to
> the relevant toolkit. Would be platform-dependent,
> since you'd have to deal with events at a low
> level.

This should not be necessary at all.

(On the other hand, I don't know if this perhaps is a real problem on
Windows?)

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list