Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtWidgets import *
- from PyQt5.QtGui import *
- from PyQt5.QtCore import *
- import sys
- class Window(QMainWindow):
- def __init__(self):
- super().__init__()
- self.title = 'PyQt5 - Events, Signals & Slots'
- self.top = 100
- self.left = 100
- self.width = 400
- self.height = 300
- self.InitWindow()
- def InitWindow(self):
- self.setWindowIcon(QIcon('skull_icon.png'))
- self.setWindowTitle(self.title)
- self.setGeometry(self.left, self.top, self.width, self.height)
- self.CreateButton()
- self.show()
- def CreateButton(self):
- self.button = QPushButton('Close', self).setGeometry(QRect(100, 100, 111, 50))
- self.button.clicked.connect(self.ClickMe())
- def ClickMe(self):
- sys.exit()
- if __name__ == '__main__':
- App = QApplication(sys.argv)
- window = Window()
- sys.exit(App.exec())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement