[PyKDE] QDialog

Eiji Katagiri katagiri at teikokupr.co.jp
Fri Nov 17 08:35:12 GMT 2000


Hi. I've try to use a QDialog, but I can't pass the argument
for 'Modal' mode. Here is a simple sample for the Dialog Window.

---

import sys
>from qt import *

class MyWidget(QDialog):
        def __init__(self, *args):
                apply(QDialog.__init__, (self,)+args)
                btn = QPushButton('Close', self)
                self.connect(btn, SIGNAL('clicked()'), self.close)
                self.adjustSize()

class WindowCreator(QWidget):
        def __init__(self, *args):
                apply(QWidget.__init__, (self,)+args)
                vbox = QVBox(self)
                newbtn =  QPushButton('New', vbox)
                quit   =  QPushButton('Quit', vbox)
                self.connect(newbtn, SIGNAL('clicked()'), self.createNew)
                self.connect(quit, SIGNAL('clicked()'), qApp, SLOT('quit()'))
                vbox.adjustSize()
                self.adjustSize()

        def createNew(self):
                self.dialog = MyWidget()
#               self.dialog.exec_loop()
                self.dialog.show()

app = QApplication(sys.argv)
win = WindowCreator()
app.setMainWidget(win)
win.show()
app.exec_loop()

---

Thanks for any help,

Eiji Katagiri




More information about the PyQt mailing list