-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
32 lines (24 loc) · 1.18 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Jan Adamczyk - 2018
"""
from PyQt5 import QtGui # Import the PyQt4 module we'll need
import sys # We need sys so that we can pass argv to QApplication
import GUI.design # This file holds our MainWindow and all design related things
# it also keeps events etc that we defined in Qt Designer
class ExampleApp(QtGui.QMainWindow, GUI.design.Ui_MainWindow):
def __init__(self):
# Explaining super is out of the scope of this article
# So please google it if you're not familar with it
# Simple reason why we use it here is that it allows us to
# access variables, methods etc in the design.py file
super(self.__class__, self).__init__()
self.setupUi(self) # This is defined in design.py file automatically
# It sets up layout and widgets that are defined
def main():
app = QtGui.QApplication(sys.argv) # A new instance of QApplication
form = ExampleApp() # We set the form to be our ExampleApp (design)
form.show() # Show the form
sys.exit(app.exec_()) # and execute the app
if __name__ == '__main__': # if we're running file directly and not importing it
main() # run the main function