[PyQt] Intercept close button and force application to Quit

Philip Lorenz lorenzph+sip at in.tum.de
Wed Dec 22 08:58:38 GMT 2010


Hi,

overwrite the closeEvent 
(http://riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#closeEvent) 
of your main window. Alternatively you can set the WA_DeleteOnClose flag 
on your widget 
(http://riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#setAttribute) 
which should terminate your threads if their parent is set to that window.

Philip

On 12/22/2010 09:49 AM, Luke Taylor wrote:
> Hi everyone,
>
> I have an application with several threads, one of which is a PyQT 
> GUI, when I click on the close button, the PyQT GUI closes but the 
> rest of the application keeps running, I would like to be able to 
> intercept the close button event and force the whole application to 
> quit. Does anybody know how I might do this?
>
> Thanks for time and help,
>
> Luke
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101222/309cdb99/attachment.html>


More information about the PyQt mailing list