Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. from PyQt5 import QtWidgets
  2. from PyQt5.QtWidgets import QMessageBox
  3.  
  4. from decryptwindow import Ui_Dialog # importing our generated file
  5.  
  6. import sys
  7. import os
  8.  
  9. class mywindow(QtWidgets.QMainWindow):
  10. def __init__(self):
  11. super(mywindow, self).__init__()
  12. self.ui = Ui_Dialog()
  13. self.ui.setupUi(self)
  14.  
  15.  
  16. ini_file = 'config.ini'
  17. ini_file_exists = os.path.isfile(ini_file)
  18.  
  19.  
  20. if ini_file_exists:
  21. # just for testing
  22. print(ini_file + ' is found')
  23. # let`s show the main window
  24. app = QtWidgets.QApplication([])
  25. application = mywindow()
  26. application.show()
  27. sys.exit(app.exec())
  28. else:
  29. # just for testing
  30. print(ini_file + ' is not found')
  31. app = QtWidgets.QApplication([])
  32. application = mywindow()
  33. application.show()
  34. error_dialog = QtWidgets.QErrorMessage()
  35. error_dialog.showMessage(ini_file + ' is not found')
  36. # after message I would like just close the application
  37. sys.exit(app.exec())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement