Setting QWidget size

Rich Shepard rshepard at
Thu Apr 22 23:57:37 BST 2021

On Thu, 22 Apr 2021, Rodrigo de Salvo Braz wrote:

> You can follow the same ideas for placing that layout with buttons in a
> tab. You can just replace
> self.setCentralWidget(container)
> by
> tabwidget = QTabWidget(self)
> tabwidget.addTab(container, "My tab")
> self.setCentralWidget(tabwidget)


If I understand correctly, I build the individual tabs in a QTabWidget
rather than individually importing them into the main application window as
tab/page content.

> It's true that eventually you will have a QMainWindow, but that should be
> ok, because your application will eventually need to use a window, right?
> And of course a QMainWindow is not required to have a status bar or menu,
> etc.

Yes, the two button file is a minimum working example. There will be about 7
tabs in the main application for data entry/modification.

> Hope that helps.

Yes, it does.

I'm going to read Alan Moore's book (and finish Martin Fitzpatrick's book)
before going back to coding. I'll still have questions but a much better
understanding of the PyQt system.

Stay well,


More information about the PyQt mailing list