Skip to content

Instantly share code, notes, and snippets.

@quan99-er
Created April 16, 2021 02:55
Show Gist options
  • Save quan99-er/eebc2a62be4cc3fbc13c686b70be7a9e to your computer and use it in GitHub Desktop.
Save quan99-er/eebc2a62be4cc3fbc13c686b70be7a9e to your computer and use it in GitHub Desktop.
auto-load GUI
import sys
from PyQt4 import QtCore, QtGui, uic
qtCreatorFile = "TestForm.ui" # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
class MyApp(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
window = MyApp()
window.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment