0
私はpyqtのデフォルトスレッドを持つpythonネイティブスレッドを使用しています。ネイティブスレッドでshow qmessageboxを実行すると、プログラムがクラッシュします。 ここに私のコードです:pyqtとネイティブのpythonスレッドqpixmapと親エラー
.........
self.serverSoc.listen(5)
self.status="Server listening on %s:%s" % serveraddr
self.serverStatus = 1
thread.start_new_thread(self.listenClients,())
def listenClients(self):
while 1:
clientsoc, clientaddr = self.serverSoc.accept()
print("Client connected from %s:%s" % clientaddr)
data = clientsoc.recv(self.buffsize)
if data.startswith('%sendchatrequest%'):
try:
requestuser = data.rsplit(':', 1)[1]
msg = "%s wanted to chat with you. Do you accept this?" %requestuser
reply = QtGui.QMessageBox.question(self, 'Chat Request',
msg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
と私は、このエラーました:
QObject::setParent: Cannot set parent, new parent is in a different thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
QPixmap: It is not safe to use pixmaps outside the GUI thread
X Error: BadImplementation (server does not implement operation) 17
Major opcode: 20 (X_GetProperty)
Resource id: 0x0
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python2.7: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
が、私はそれをどのように修正することができますか?ありがとうございました