Skip to content

Commit d1d867a

Browse files
committed
Handle interruption signal in example #232
1 parent 1b8b78b commit d1d867a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

basic_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/python
22
# -*- coding: utf-8 -*-
33
import os
4+
import signal
45

56
from Qt import QtCore, QtWidgets
67

@@ -20,6 +21,9 @@
2021
)
2122

2223
if __name__ == '__main__':
24+
# handle SIGINT to make the app terminate on CTRL+C
25+
signal.signal(signal.SIGINT, signal.SIG_DFL)
26+
2327
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
2428

2529
app = QtWidgets.QApplication([])

0 commit comments

Comments
 (0)