<br>I&#39;ve made a simple gui that has just a few widgets on it using QTDesigner<br>I was able to preview the code in QtDesigner<br><br>I&#39;m trying to launch it now from a command line script, using this example on Riverbank&#39;s page
<br><br><a href="http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#using-the-generated-code">http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#using-the-generated-code</a><br>The first example shows the direct approach where we simply create a simple
application to create the dialog:
<pre class="literal-block">import sys<br>from PyQt4 import QtGui<br>from ui_imagedialog import Ui_ImageDialog<br><br>app = QtGui.QApplication(sys.argv)<br>window = QtGui.QDialog()<br>ui = Ui_ImageDialog()<br>ui.setupUi(window)
<br><br>window.show()<br>sys.exit(app.exec_())<br></pre><br>I&#39;ve substituted Ui_ImageDialog with the class generated by QTDesigner<br><br>from PyQt4 import QtCore, QtGui<br>from mainwindow import Ui_MainWindow<br><br>
class MainWindow(QtGui.QDialog):<br>&nbsp;&nbsp;&nbsp; def __init__(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; app = QtGui.QApplication(sys.argv)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; window = QtGui.QDialog()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.ui = Ui_MainWindow()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.ui.setupUi(window)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
window.show()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sys.exit(app.exec_())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br><br>mainwindow = MainWindow()<br><br><br>however, I get this error, which I dont understand.<br><br>Traceback (most recent call last):<br>&nbsp; File &quot;maingui.py&quot;, line 16, in ?
<br>&nbsp;&nbsp;&nbsp; mainwindow = MainWindow()<br>&nbsp; File &quot;maingui.py&quot;, line 12, in __init__<br>&nbsp;&nbsp;&nbsp; self.ui.setupUi(window)<br>&nbsp; File &quot;C:\Code\mainwindow.pyw&quot;, line 227, in setupUi<br>&nbsp;&nbsp;&nbsp; MainWindow.setCentralWidget
(self.centralwidget)<br>AttributeError: setCentralWidget<br><br><br>Would someone explain what I&#39;m doing wrong?<br><br><br><br>