May 2019
Intermediate to advanced
542 pages
13h 37m
English
Up until now, we've been using the humble QWidget as the base class for our top-level window. This works well for simple forms, but it lacks many of the features that we might expect from an application's main window, such as menu bars or toolbars. Qt provides the QMainWindow class to address this need.
Make a copy of the application template from Chapter 1, Getting Started with PyQt, and let's make a small but crucial change:
class MainWindow(qtw.QMainWindow):
Instead of inheriting from QWidget, we'll inherit from QMainWindow. As you'll see, this will change the way we have to code our GUI, but it will also add a number of nice features to our main window.
To explore these new features, let's build a simple plain text ...
Read now
Unlock full access