Okay while I found out what it is you need to reference I did not find how to reference it but I am sure that if you dig hard enough (and sometimes you need an industrial sized backhoe) you can find the how -- but the object is called the QTableCornerButton (aka its a button not a header element). I tried the obvious which is shown below but that had no effect. Other than that I cleaned up your code some (but it still is not very python-qt5-ish) and explained why I changed what I did. I hope these help you move in a positive direction and help you track down that elusive reference to the QTableCornerButton
from PySide2.QtGui import QFont from PySide2.QtWidgets import QApplication, QDialog, QFrame, QTableWidget, QGridLayout # No longer needed # import sys class MainWindow(QDialog): def __init__(self): # Do not use Super( ) unless you fully understand the 3 issues # that need to be handled within your code to implement it # correctly -- further unless you need it for that rather rare # case it was designed for you are creating more issues for no # reason since you do not have the rare issue # super(MainWindow, self).__init__() QDialog.__init__(self) # Do you really need a Class Font as it is only used once # self.ClassFont = QFont('Calibri', 10) self.resize(600, 300) # ------- self.table = QTableWidget() # ------- # Do not create a function for 2 lines of non-repeated code # table_box = self.create_table_box() table_box = QGridLayout() table_box.addWidget(self.table, 0, 0) # ------- self.table_group = QFrame() self.table_group.setLayout(table_box) # ------- # You really do not need a Grid Layout here a QVBoxLayout and/or QHBoxLayout # would have worked just as well with less overhead self.layout = QGridLayout() # You are only using 1 Column and 1 Row of the Grid Layout so why are you # setting the Spacing this does not affect your Table Widget's Columns self.layout.setSpacing(5) self.layout.addWidget(self.table_group, 0, 0) # ------- self.setLayout(self.layout) # ------- self.construct_table() def construct_table(self): column_size = [100, 260, 150] column_labels = ["A", "B", "C"] rowLabels = [] for i in range(50): rowLabels.append(str(i + 1)) self.table.setRowCount(10) self.table.setColumnCount(len(column_size)) self.table.setFixedWidth(sum(column_size) + 34) self.table.setFixedHeight(157) self.table.verticalHeader().setMinimumSectionSize(23) self.table.verticalHeader().setMaximumSectionSize(23) self.table.verticalHeader().setDefaultSectionSize(23) self.table.setHorizontalHeaderLabels(column_labels) self.table.setVerticalHeaderLabels(rowLabels) self.table.verticalHeader().setVisible(True) # If you do not need a Class Level variable do not create it # self.table.setFont(self.ClassFont) self.table.setFont(QFont('Calibri', 10)) cnt = 0 for column in column_size: self.table.setColumnWidth(cnt, column) cnt += 1 self.table.setStyleSheet("QHeaderView::section {background-color: rgb(100, 100, 100); color: rgb(200, 200, 200);}") # Again while this does not seem to do anything it does not crash either so maybe its a peek into what you need to do self.table.setStyleSheet("QTableCornerButton::section {background-color: rgb(100, 100, 100); color: rgb(200, 200, 200);}") if __name__ == '__main__': # First if you are not using Command Line arguments do not reference them # and if you do use Command Line arguments use the argparser library instead # it handles them much more cleanly and intuitively # app = QApplication(sys.argv) MainEvntHndlr = QApplication([]) # When setting the Application Style be sure to reference the Application # object you created as well use the method correctly # QApplication.setStyle(QStyleFactory.create('Fusion')) MainEvntHndlr.setStyle('Fusion') MainApp = MainWindow() MainApp.show() # This is how to do this in Qt5 your version was Qt4 # sys.exit(app.exec_()) MainEvntHndlr.exec()