[PyQt] Q(Core)Application.exec_() is not interruptable

Ewald de Wit erdewit at zonnet.nl
Thu May 1 20:54:32 BST 2008


On Thursday 01 May 2008 14:28:31 İsmail Dönmez wrote:
> Following code can't be interrupted with CTRL-C :
> >>> import sys
> >>> from PyQt4.QtCore import QCoreApplication
> >>> QCoreApplication.exec_(sys.argv)
>
> Is this somehow intended and is there a way to overcome this?

You can catch the signal like this:

import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

import sys
from PyQt4.QtCore import QCoreApplication
app = QCoreApplication(sys.argv)
app.exec_()

This is tested to work on linux, windows and osx.

--
  --  Ewald



More information about the PyQt mailing list