[PyQt] multiple dialog boxes simultaneously

Pradnyesh Sawant spradml at gmail.com
Thu Nov 29 06:21:15 GMT 2007

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:
            thr = threading.Thread(target = self.makeEntry)
    def makeEntry(self):
        if self.app is None:
            self.app = QtGui.QApplication(sys.argv)
        print 'inside makeEntry'

        dialog = Gui()
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)

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071129/27cd19e9/attachment-0001.bin

More information about the PyQt mailing list