QTabWidget: first tab's text not displaying

Rich Shepard rshepard at appl-ecosys.com
Fri Apr 30 22:12:25 BST 2021


The attached screenshot shows all 8 tabs, but the identifying text on the
first one is missing and I don't see why that tab is different.

Here's the relevant code:

from views.locations import SitesWindow
from views.geochem import GeochemWindow
from views.biota import BiotaWindow
from views.physical import PhysicalWindow
from views.microbes import MicrobesWindow
from views.wx_data import WxDataWindow
from views.wx_locations import WxSitesWindow
from views.wx_params import WxParamsWindow

class MainWindow(qtw.QMainWindow):
     def __init__(self):
         """MainWindow constructor"""
         super().__init__()

         self.setWindowTitle('OpenEDMS')
         self.statusBar()
         self.setFixedSize(800, 600)

         # tab contents
         self.loc = SitesWindow()
         self.che = GeochemWindow()
         self.bio = BiotaWindow()
         self.phy = PhysicalWindow()
         self.mic = MicrobesWindow()
         self.wxd = WxDataWindow()
         self.wxp = WxParamsWindow()
         self.wxl = WxSitesWindow()

         tabs = qtw.QTabWidget()
         tabs.setMovable(False)
         self.setCentralWidget(tabs)
         # add tab pages here
         tabs.addTab(self.loc, 'Sites')
         tabs.addTab(self.che, 'Chemicals')
         tabs.addTab(self.bio, 'Biota')
         tabs.addTab(self.phy, 'Physical')
         tabs.addTab(self.mic, 'Microbes')
         tabs.addTab(self.wxp, 'WX Data')
         tabs.addTab(self.wxl, 'WX Params')
         tabs.addTab(self.wxd, 'WX Sites')

         self.show()

All eight look the same to me, but 'Sites' is not displayed on the first
tab. What have I missed here?

TIA,

Rich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: application-main-window.png
Type: image/png
Size: 11853 bytes
Desc: 
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210430/f26d5cff/attachment-0001.png>


More information about the PyQt mailing list