Previewing a form

On the #pyqt channel on Freenode, a_l_e asked for a way to preview a main window form created in Qt Designer.

   1 import sys
   2 
   3 from PyQt4.QtGui import QApplication
   4 from PyQt4.uic import loadUi
   5 
   6 if __name__ == "__main__":
   7 
   8     app = QApplication(sys.argv)
   9     
  10     if len(app.arguments()) != 2:
  11     
  12         sys.stderr.write("Usage: %s <ui file>\n" % app.arguments()[0])
  13         sys.exit()
  14     
  15     window = loadUi(app.arguments()[1])
  16     window.show()
  17     sys.exit(app.exec_())

PyQt/Previewing a form (last edited 2014-06-07 22:56:22 by DavidBoddie)

Unable to edit the page? See the FrontPage for instructions.