[PyKDE] qApp.quit()

Phil Thompson phil at riverbankcomputing.co.uk
Fri Aug 15 19:32:01 BST 2003


On Friday 15 August 2003 6:04 pm, Vincent Wagelaar wrote:
> Hi,
>
> In my maindialog i'm trying to close the application when an error has
> occurred. But my application won't stop running.
>
> a = QApplication(sys.argv)
>
> w = mainwindow()
> a.setMainWindow(w)
> a.exec_loop()
>
>
> class mainwindow(QMainWindow):
>     def __init__(self, *args):
>          QMainWindow.__init__(self, *args)
>          error = 1
>          if error:
>              qApp.quit()
>          else:
>              self.show()
>
>
> This will not close the application

QApplication.quit() causes a return from QApplication.exec_loop(). It doesn't 
actually terminate the current process. As the event loop isn't running when 
you call it, the call has no effect.

Phil




More information about the PyQt mailing list