[Qt-interest] Ctrl-C exit of qapp
Terrence Cole
list-sink at trainedmonkeystudios.org
Sun Sep 26 23:20:55 CEST 2010
On Sat, 2010-09-25 at 22:07 -0700, emmanuel_mayssat at lynceantech.com
wrote:
> Hello,
>
> I am trying to catch the Ctrl-C exception to close the qapplication I am running. How do i do that?
>
> try:
> qapp.exec_()
> except KeyboardInterupt as e:
> ...
> doesn't work!
You have to reset the SIGINT handler after QApp init.
Try:
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
Although, as other people have said, this is probably a bad idea. I
personally find it useful -- during development -- as a method to keep
bad ideas from making the app unkillable without a trip to a different
terminal.
-Terrence
> Please help,
>
More information about the Qt-interest-old
mailing list