I have a PySide app that does a task in a background QThread
. Sometimes in the middle of the task there is a step that requires input from the user through a dialog. I'm having trouble invoking the code QtGui.QinputDialog.getText
from the worker thread.
I have something like this:
class Communicate(QtCore.QObject):
signal = QtCore.Signal((str, str))
def ask_user(title, text):
return QtGui.QInputDialog.getText(None, title, text)
(Then in the function that actually does the work)
def longtask():
dialogneeded = network_io()
if dialogneeded:
x = Communicate()
x.signal.connect(ask_user)
x.signal.emit("A title", "Some text")
more_long_work_to_do()
I understand that this snippet doesn't even look at the value that the user gave, but I'm just trying to get something that can at least show the dialog.
Here is the error that I get:
[xcb] Extra reply data still left in queue
[xcb] This is most likely caused by a broken X extension library
[xcb] Aborting, sorry about that.
python: xcb_io.c:575: _XReply: Assertion `!xcb_xlib_extra_reply_data_left' failed.
Aborted