Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Added more examples
  • Loading branch information
mooshu1x2 committed Jul 26, 2016
1 parent 1cce85d commit af2694f613b1d8db814c28a233eda0bfccd8666d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
@@ -42,6 +42,7 @@ def initUI(self):

def test_app ():
app = QApplication(sys.argv)
app.setObjectName ("testApplication")
ex = TestApplication()
ale = Ale ()
# install globally
@@ -0,0 +1,52 @@
"""
ZetCode PyQt5 tutorial
This program shows a confirmation
message box when we click on the close
button of the application window.
author: Jan Bodnar
website: zetcode.com
last edited: January 2015
"""

import sys
from PyQt5.QtWidgets import QWidget, QMessageBox, QApplication
from userale.ale import Ale

class Example(QWidget):

def __init__(self):
super().__init__()

self.initUI()


def initUI(self):

self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Message box')
self.show()


def closeEvent(self, event):

reply = QMessageBox.question(self, 'Message',
"Are you sure to quit?", QMessageBox.Yes |
QMessageBox.No, QMessageBox.No)

if reply == QMessageBox.Yes:
event.accept()
else:
event.ignore()


def test_close ():

app = QApplication(sys.argv)
ex = Example()
ale = Ale ()
# install globally
app.installEventFilter (ale)

sys.exit(app.exec_())

0 comments on commit af2694f

Please sign in to comment.