I want to build this tag section from WordPress with pyqt
But I have two issues:
I want to set widget in each row as much as possible!
After I remove one item item it going to resize itself like it dose in WordPress!
The code:
...
def btn_Tags(self,tagName):
def Btn_tag_destroy(tag_objectName):
for btns in self.groupBox.findChildren(QtWidgets.QPushButton):
if btns.objectName() == tag_objectName:
btns.deleteLater()
self.tagList.remove(btns.text())
break
# Buliding tags
counter = len(self.tagList)
btn_tag_tag = QtWidgets.QPushButton(self.Frame_Tags) #QFrame
btn_tag_tag.setObjectName(f'btn_tag_{counter}')
btn_tag_tag.setText(tagName)
btn_tag_tag.setStyleSheet('QPushButton{qproperty-icon: url(close.png);}')
btn_tag_tag.clicked.connect(lambda: Btn_tag_destroy(f'btn_tag_{counter}'))
# i did some stuff for geting 3x? grid format but its not what i want
self.gridLayout.addWidget(btn_tag_tag,int((counter-1)/3),self.col)
self.col += 1
if self.col>2:
self.col=0