Hello, I want to have multiple dialog boxes simultaneously. So I have a function, which is the target for threading.Thread, and which creates a new dialog. But I'm getting the following error: ASSERT failure in QWidget: "Widgets must be created in the GUI thread.", file kernel/qwidget.cpp, line 951
My code is as follows:
*********************************************************************
import time
import threading
import sys
from PyQt4 import QtGui, QtCore
class Journal(object):
def __init__(self):
self.thrLst = []
self.app = None
while True:
time.sleep(1)
thr = threading.Thread(target = self.makeEntry)
self.thrLst.append(thr)
thr.start()
def makeEntry(self):
if self.app is None:
self.app = QtGui.QApplication(sys.argv)
print 'inside makeEntry'
dialog = Gui()
sys.exit(dialog.exec_())
class Gui(QtGui.QDialog):
def __init__(self, parent = None):
QtGui.QDialog.__init__(self, parent)
frameStyle = QtGui.QFrame.Sunken | QtGui.QFrame.Panel
self.lCntr = QtGui.QLabel()
loGrd = QtGui.QGridLayout()
loGrd.addWidget(self.lCntr, 0, 0)
self.setLayout(loGrd)
self.setWindowTitle(self.tr("Counter"))
if __name__ == "__main__":
jrnl = Journal()
*********************************************************************
What am I doing wrong?
--
warm regards,
Pradnyesh Sawant
--
Nothing clarifies your ideas like trying to write them down. --Montaigne
signature.asc
Description: Digital signature
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
