[PyKDE] QCanvas.advance() from other than the GUI thread

Miller, Douglas dmiller at JFTI.com
Tue Sep 9 00:31:01 BST 2003

On SuSE 8.0 with Qt at 3.0.3, PyQt/SIP at 3.4 the following works from a
thread OTHER than the GUI thread:
    def doAdvance(self, parent, tyme):
        #lock GUI resources with the Qt Library Mutex
        tyme = tyme + 1/float(ADVANCE_RATE_DIVISOR)     #modify time by
advance rate 
        #enter next absolute time event
        self.schedule.enterabs(tyme, 1, self.doAdvance, (parent, tyme)) 
Also, on Red 9.0 with Qt at 3.1.1, PyQt/SIP at 3.5 the above also works
BUT, on SuSE 8.2 with Qt at 3.1.1, PyQt/SIP at 3.8 the above does NOT work.
When my application is executed I get the following errors:
Xlib: unexpected async reply .....
OR something like
X Error: BadPixmap (invalid Pixmap parameter) 4
  Major opcode:  56
  Minor opcode:  0
  Resource id:  0x50046

X Error: BadLength (poly request too large or internal Xlib length error) 16
  Major opcode:  75
  Minor opcode:  0
  Resource id:  0x0
These error messages disappear when 'parent.childCanvas.advance()' is
commented out.
I know this has something to do with threading, because the mail Qt mail
archive has postings with these kinds of errors.
The real question that I have is what happened between PyQt 3.5 and PyQt 3.8
that this is now a problem when it was not before?
What can be done about this problem?
NOTE: If, in the GUI thread, I use QCanvas.setAdvancePeriod () or if I use a
QTimer to call QCanvas.advance() on a regular basis, object motion on the
canvas slows when the application is under heavy utilization.  The above
construct has been the only way that I could keep object motion constant.
Thanks for any help.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030909/051dfeb2/attachment.html

More information about the PyQt mailing list