so I\'m creating a simple windows application with Python and PyQt4. I\'ve designed my UI the way I want it in QtCreator and I\'ve created the necessary .py file from the .ui fi
You need to inherit from QMainWindow
, not QWidget
. setCentralWidget
is a method of QMainWindow
.
from PyQt4.QtCore import Qt, SIGNAL
from PyQt4.QtGui import *
from ui_mainwindow import Ui_MainWindow
class Window(QMainWindow, Ui_MainWindow):
def __init__(self, parent = None):
QMainWindow.__init__(self, parent)
# or better
# super(Window, self).__init__(parent)
self.setupUi(self)