[PyQt] modeless dialog - repeated windows

Susana Sanchez Exposito sse at iaa.es
Tue Jul 26 08:23:45 BST 2011


Thank you very much!,
The solution is easier than I thought :-)



2011/7/25 Baz Walter <bazwal at ftml.net>

> On 25/07/11 12:20, Susana Sanchez Exposito wrote:
>
>> I would like if the user  selects the option to open the modeless dialog
>> and
>> this dialog is opened yet, this dialog would be focused instead of opening
>> another window of the same modeless dialog.
>>
>
> import sys
> from PyQt4 import QtGui, QtCore
>
> class Window(QtGui.QPushButton):
>    def __init__(self):
>        QtGui.QPushButton.__init__(**self, 'Open')
>        self.dialog = QtGui.QMessageBox(self)
>        self.dialog.setWindowModality(**QtCore.Qt.NonModal)
>        self.clicked.connect(self.**showDialog)
>
>    def showDialog(self):
>        self.dialog.show()
>        self.dialog.activateWindow()
>
> if __name__ == '__main__':
>
>    app = QtGui.QApplication(sys.argv)
>    win = Window()
>    win.move(600, 400)
>    win.dialog.move(600, 500)
>    win.show()
>    sys.exit(app.exec_())
>
> ______________________________**_________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.**com/mailman/listinfo/pyqt<http://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>



-- 
Susana Sánchez Expósito

Instituto de Astrofísica de Andalucía   IAA (CSIC)
Camino Bajo de Huétor, 50. Granada E-18008
Tel:(+34) 958 121 311 / (+34) 958 230 618
Fax:(+34) 958 814 530
e-mail: sse at iaa.es
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110726/89d3da6f/attachment.html>


More information about the PyQt mailing list