Advertisement
mercibac

main.py

May 25th, 2021
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # This Python file uses the following encoding: utf-8
  2. import sys
  3. import os
  4.  
  5. from PySide2.QtGui import QGuiApplication
  6. from PySide2.QtQml import QQmlApplicationEngine
  7. from app_modules import *
  8.  
  9. # Instastiate a QGuiApplication class in order to acces it in my QmlTranslor.py file
  10. class App(QGuiApplication):
  11.     pass
  12.  
  13.  
  14. if __name__ == "__main__":
  15.     app = App(sys.argv)
  16.  
  17.     qmltranslator = QmlTanslator()
  18.  
  19.     engine = QQmlApplicationEngine()
  20.  
  21.     engine.rootContext().setContextProperty('translator', qmltranslator)
  22.     engine.load(os.path.join(os.path.dirname(__file__), "main.qml"))
  23.  
  24.     if not engine.rootObjects():
  25.         sys.exit(-1)
  26.     sys.exit(app.exec_())
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement