When ever I try to compile the following code I get the error:
class MyApp(QtGui.QMainWindow, Ui_MainWindow):
NameError: name ‘Ui_MainWindow’ is not defined
My code is:
import sys
import clientGUI
from PyQt4 import QtCore, QtGui
class MyApp(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
clientGUI.Ui_MainWindow.__init__(self)
self.setupUi(self)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
window = MyApp()
window.show()
sys.exit(app.exec_())
It looks like
Ui_MainWindowis defined inclientGUI, so you need to reference it asOr you can import it as:
and then use this name in code.
See more info about modules in Python 3 tutorial