i need help with this it's complicated some how ! i try hard before post this i want to store each info text for each button from the loop to pass it throw new function i hope i did explain the problem well
ch_list = [{'icon':'url../img.jpg', 'value':'str', 'info':'text'},
{'icon':'url../img.jpg', 'value':'str', 'info':'text'}, .....]
# value_1 & value_2 is ignored ..
def put_chan(self, ch_list):
position = [(i, j) for i in range(len(ch_list)-1) for j in range(4)]
for ch, position in zip(ch_list, position):
QApplication.processEvents()
ch_img = str(ch['icon'])
data = urllib.request.urlopen(ch_img).read()
pixmap = QPixmap()
pixmap.loadFromData(data)
icon = QIcon(pixmap)
btn = QPushButton()
btn.setFixedSize(75, 50)
btn.setIcon(icon)
btn.setIconSize(QtCore.QSize(75, 50))
btn.clicked.connect(lambda x: self.btn_clicked(ch['info']))
self.grid.addWidget(btn, *position)
def btn_clicked(self, txt):
print(txt)