Advertisement
metalx1000

Load QT ui file with Python and PySide

Apr 4th, 2015
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #!/usr/bin/env python
  2. from PySide import QtCore, QtGui, QtUiTools
  3.  
  4.  
  5. def loadUiWidget(uifilename, parent=None):
  6. loader = QtUiTools.QUiLoader()
  7. uifile = QtCore.QFile(uifilename)
  8. uifile.open(QtCore.QFile.ReadOnly)
  9. ui = loader.load(uifile, parent)
  10. uifile.close()
  11. return ui
  12.  
  13.  
  14. if __name__ == "__main__":
  15. import sys
  16. app = QtGui.QApplication(sys.argv)
  17. MainWindow = loadUiWidget("untitled.ui")
  18. MainWindow.show()
  19. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement