[PyQt] Problem with a simple QDialog

Alexandre Badez alexandre.badez at gmail.com
Wed Nov 28 09:40:58 GMT 2007


On Nov 28, 2007 10:21 AM, Horst Herb <subscriptions at gnumed.net> wrote:

> On Wednesday 28 November 2007, Alexandre Badez wrote:
> > wChapterSelection = QtGui.QDialog()
> > wChapterSelection.exec_()
> >
> > And I've got also a bus error.
> >
> > What really suprise me, is that I already use QDialog elsewhere, and I
> > didn't had any problem with this.
>
> app = QApplication(sys.argv)
> wChapterSelection = QtGui.QDialog()
> wChapterSelection.show()
> app.exec_()
>
> would work.
> I am a newbie to PyQt4, so I don't know whether you can just run a widget
> itself  without creating an application first - but if you do, it works
>
> Horst
>
>
Thanks Horst.

I know it work, and I can do it as you type.
But the problem in your exemple, is that the show is not blocking so you can
do something like

myDialog = myDialogClass()

myDialog.exec_()

if myDialog.result == myDialog.accept():
    # do something
else:
    #do something else

-- 
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071128/30f2bb61/attachment.html


More information about the PyQt mailing list