Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5 import QtWidgets
- from PyQt5.QtWidgets import QMessageBox
- from decryptwindow import Ui_Dialog # importing our generated file
- import sys
- import os
- class mywindow(QtWidgets.QMainWindow):
- def __init__(self):
- super(mywindow, self).__init__()
- self.ui = Ui_Dialog()
- self.ui.setupUi(self)
- ini_file = 'config.ini'
- ini_file_exists = os.path.isfile(ini_file)
- if ini_file_exists:
- # just for testing
- print(ini_file + ' is found')
- # let`s show the main window
- app = QtWidgets.QApplication([])
- application = mywindow()
- application.show()
- sys.exit(app.exec())
- else:
- # just for testing
- print(ini_file + ' is not found')
- app = QtWidgets.QApplication([])
- application = mywindow()
- application.show()
- error_dialog = QtWidgets.QErrorMessage()
- error_dialog.showMessage(ini_file + ' is not found')
- # after message I would like just close the application
- sys.exit(app.exec())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement