The problem of how to dynamically refresh checkbox in pyqt5 Development

bulk added checkbox to gridlayout, and how to remove these checkbox when refreshing the page.
attach code

def __init__():
    self.model_gridlayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
    self.model_gridlayout.setContentsMargins(0, 0, 0, 0)
    self.model_gridlayout.setObjectName("model_gridlayout")

def create_box():
        for i in data:
            if i[0]:
                    checkbox = self.create_checkbox(i[0],i[1])
                    self.model_gridlayout.addWidget(checkbox, x, index, 1, 1)
                    self.model_widgets.append(checkbox)
Nov.29,2021

clear it out during the refresh operation.


problem has been solved. For more information, please refer to my brief
https://www.jianshu.com/p/8ea.
if you have any questions, please feel free to ask or add

.
Menu