[PyKDE] PyQt - getting unexpected async reply in threaded app (newbie)

Nicholas John Murison nick at urgusabic.net
Sat Feb 22 12:54:01 GMT 2003


Hi all,

Both a colleague and I have run into the identical problem when using
PyQt in a threaded environment.

I have a threaded app, which uses QThreads for the threading model.  I
am trying to get the child threads to be able to create and display
windows as part of the GUI.  To my knowledge, all GUI creation must take
place within one thread in PyQt.  Therefore I am trying to do all GUI
calls from the main thread.  This isn't working, and I keep getting
"unexpected async reply" errors from Xlib.

Let me demonstrate my object instance hierarchy:

__main__
  -> creates a QApplication
  -> creates a QObject derivative
     -> creates QThread derivatives
        -> creates SocketServer.TCPServer derivatives
           -> creates SocketServer.BaseRequestHandler derivatives
	      -> calls main QObject derivative instance and asks for a
                 window to be displayed

This last step is where it all goes wrong.

My classes are split over several files, a few of which need to import
qt.  So the qt module is imported several times over, which hopefully is
ok.

Also, I tried referring to the global qApp object, both in my
BaseRequestHandler derivative class, and in the main QObject derivative
class in the main thread.  In both of these cases, Python claimed qApp
did not exist.

Any suggestions would be most helpful.

Thank you,
-- 
Nicholas John Murison
~~~~~~~~~~~~~~~~~~~~~
Don't mess with penguins
http://www.urgusabic.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030222/5a40465a/attachment.bin


More information about the PyQt mailing list