Skip to content

Instantly share code, notes, and snippets.

@saleph
Last active March 25, 2016 18:34
Show Gist options
  • Save saleph/91332b59f1a50df2f078 to your computer and use it in GitHub Desktop.
Save saleph/91332b59f1a50df2f078 to your computer and use it in GitHub Desktop.
[qt5] signals - quiting
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import QWidget, QPushButton, QApplication
from PyQt5.QtCore import QCoreApplication
class Example(QWidget):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
qbtn = QPushButton('Quit', self)
qbtn.clicked.connect(QCoreApplication.instance().quit)
qbtn.resize(qbtn.sizeHint())
qbtn.move(50, 50)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Quit button')
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment