Долгая загрузка программы python. Тормозит Combobox

Python. Создаётся много combobox, из-за этого скорость загрузки программы составляет 5 секунд. Как можно ускорить запуск программы?

                        for k in range(1,5):
                            self.comboBox = QtWidgets.QComboBox()
                            self.comboBox.setObjectName(u"comboBox")
                            self.comboBox.setGeometry(QRect(140, 140, 110, 22))
                            self.comboBox.setFocusPolicy(Qt.ClickFocus)
                            self.comboBox.wheelEvent = lambda event: None
                            for j in range(len(self.CBItems[k-1])):
                                self.comboBox.addItem("")
                                self.comboBox.setItemText(j, self.CBItems[k-1][j])
                            if tup[k]!= None:
                                self.comboBox.setCurrentIndex(int(tup[k]))
                            else:
                                self.comboBox.setCurrentIndex(0)
                            self.comboBox.currentIndexChanged.connect(self.changeData)
                            self.ui.LsTable.setCellWidget(row, col, self.comboBox)

Вот тестовый код

from PySide2 import QtWidgets, QtGui, QtCore
from PySide2.QtCore import QObject, QRect, Qt, QDate
from ui_Main import Ui_MainWindow
import sys
from time import time

class MyWindow(QtWidgets.QMainWindow):
    CBItems=[]
    lTime=[]
    ts=[
        'Не указан',
        '1',
        '2',
        '3',
        '4',
        '5',
        ]
    zv_shat = [
        'Не указан',  # 0
        '1',  # 1
        '2',  # 2
        '3',  # 3
        '4',  # 4
        '5',  # 5
        '6',  # 6
        '7',  # 7
        '8',  # 8
        '9',  # 9
        '10',  # 10
        '11',  # 11
        '12',  # 12
        '13',  # 13
        '14',  # 14
        '15',  # 15
        '16',  # 16
        '17',  # 17
    ]
    zv = [
          'Не указан', #0
          '1', #1
          '2', #2
          '3', #3
          '4', #4
          '5', #5
          '6', #6
          '7', #7
          '8', #8
          '9', #9
          '10', #10
          '11', #11
          '12', #12
          '13', #13
          '14', #14
          '15', #15
          '16' #16
          ]
    forms = [
          'Не указано',  #0
          '1', #1
          '2', #2
          '3', #3
          '4', #4
          '5', #5
          '6', #6
          '7', #7
          '8', #8
          '9', #9
          '10', #10
          '11', #11
          '12', #12
          '13', #13
          '14' #14
          ]

    CBItems.append(ts)
    CBItems.append(zv_shat)
    CBItems.append(zv)
    CBItems.append(forms)

    def __init__(self):
        self.lTime.append(time())
        super(MyWindow, self).__init__()
        self.lTime.append(time())
        print("Init Super", self.lTime[-1]-self.lTime[-2])
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.lTime.append(time())
        print("Init UI", self.lTime[-1]-self.lTime[-2])
        #Objects changes
        self.ui.LsTable.setSortingEnabled(True)
        self.lTime.append(time())
        print("connecting signals", self.lTime[-1]-self.lTime[-2])
        self.refreshLsTab()
        self.lTime.append(time())
        print("Init Time Elapsed:",self.lTime[-1]-self.lTime[0])

    def refreshLsTab(self):
        self.lTime.append(time())
        print('<-----------------START refresh LsTab at:',self.lTime[-1]-self.lTime[-2],'------------------>')
        self.lTime.append(time())
        print("extracting data", self.lTime[-1]-self.lTime[-2])
        self.ui.LsTable.setRowCount(450)
        self.ui.LsTable.setColumnCount(14)
        row = 0
        self.lTime.append(time())
        print("forming Header", self.lTime[-1]-self.lTime[-2])
        for z in range(1,451):
            col=0
            for k in range(1,5):
                self.comboBox = QtWidgets.QComboBox()
                self.comboBox.setObjectName(u"comboBox")
                self.comboBox.setGeometry(QRect(140, 140, 110, 22))
                self.comboBox.setFocusPolicy(Qt.ClickFocus)
                self.comboBox.wheelEvent = lambda event: None
                for j in range(len(self.CBItems[k-1])):
                    self.comboBox.addItem("")
                    self.comboBox.setItemText(j, self.CBItems[k-1][j])
                self.comboBox.setCurrentIndex(0)
                self.ui.LsTable.setCellWidget(row, col, self.comboBox)
                col+=1
            self.lTime.append(time())
            row+=1
        print('<------------------END refresh LsTab at:',self.lTime[-1]-self.lTime[0],'------------------->')

if __name__== '__main__':
    app=QtWidgets.QApplication([])
    application = MyWindow()
    application.show()
    sys.exit(app.exec_())

Ответы (0 шт):