[PyQt] multiple dialog boxes simultaneously

Pradnyesh Sawant spradml at gmail.com
Fri Nov 30 02:29:37 GMT 2007


Hello,
I have 2 new doubts, related to the same problem. As suggested by Oleg, I'm
now going on creating new dialogs as I require. I'll first give an overview
of the code:

***************************************************************************
from time import ctime, time, sleep
import sys
from PyQt4 import QtGui, QtCore

class Jrnl(QtGui.QDialog):
    def __init__(self, parent = None):
        QtGui.QDialog.__init__(self, parent)

        self.createFe()
        self.showFe()
    def createFe(self):
        # create widgets and add them to layout
    def showFe(self):
        tmr = QtCore.QTimer(self)
        tmr.setSingleShot(True)
        self.connect(tmr, QtCore.SIGNAL("timeout()"), self.newDialog)
        tmr.start(1000)
        # sleep(1)
        # self.newDialog()
    def newDialog(self):
        self.show()
        jrnl = Journal()
if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    jrnl = Journal()
    sys.exit(jrnl.exec_())
***************************************************************************
So, basically, what I'm trying to do is as soon as one jrnl instance shows
itself, it creates a new instance (of Journal class). It works fine with
the sleep(1) statement (the statements which are commented in the showFe
method), but hangs the dialog (i can't do anything to/with it). However,
the QTimer thing does not seem to work at all :(

The other doubt is that only the last created dialog box can have focus.
How do I make it possible to give all dialog boxes the focus?

Can anyone kindly tell me what I'm doing wrong and help me out?
-- 
warm regards,
Pradnyesh Sawant
--
If I have seen further, it is by standing on the shoulders of giants. --Sir
Isaac Newton, Letter to Robert Hooke, February 5, 1675
-------------- 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/20071130/e4437fec/attachment.bin


More information about the PyQt mailing list