May 2019
Intermediate to advanced
542 pages
13h 37m
English
QMainWindow is divided into several sections, the most important of which is the central widget. This is a single widget that represents the main business part of the interface.
We set this by passing a reference to any widget to the QMainWindow.setCentralWidget() method, like this:
self.textedit = qtw.QTextEdit() self.setCentralWidget(self.textedit)
There can be only one central widget, so in a more complex application (such as a data entry app, for instance) it will more likely be a QWidget object on which you've arranged a more complex GUI; for our simple text editor, a single QTextEdit widget will suffice. Notice that we do not set a layout on the QMainWindow; doing so would break the preset arrangement of components. ...
Read now
Unlock full access