From 561d7de3fade363bdaa60776b4a9125e2d3ac6e5 Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 19 Jan 2020 02:15:35 -0600 Subject: [PATCH] Do something? --- main.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) mode change 100644 => 100755 main.py diff --git a/main.py b/main.py old mode 100644 new mode 100755 index 0c4b88a..d6cf14b --- a/main.py +++ b/main.py @@ -8,5 +8,36 @@ # Distributed under terms of the MIT license. # +import PyQt5.QtGui as qtg +import PyQt5.QtWidgets as qtw +import sys +class BadWitch: + def __init__(self, Argv): + # Initialize UI + self.app = qtw.QApplication(Argv) + self.main_window = qtw.QMainWindow() + # Initialize a UI helper + self.ui = Ui_MainHelper() + # Build the application + self.ui.create_actions(self.app, self.main_window) + self.ui.create_menus(self.app, self.main_window) + self.ui.build_mainwindow(self.app, self.main_window) + def show_application(self): + self.main_window.show() + self.app.exec_() + +class Ui_MainHelper: + def create_actions(self, App, MainWindow): + self.action_exit = qtw.QAction(qtg.QIcon.fromTheme("application-exit"), "Quit") + self.action_exit.triggered.connect(App.closeAllWindows) + def create_menus(self, App, MainWindow): + self.menu_file = qtw.QMenu("File") + def build_mainwindow(self, App, MainWindow): + self.menu_file.addAction(self.action_exit) + MainWindow.menuBar().addMenu(self.menu_file) + +if __name__ == "__main__": + bw = BadWitch(sys.argv) + bw.show_application()