触发函数
def buttonClicked(index):
print(index)
# 按钮名称 (遍历给每个对象里增加一个函数)
button = [{"name": "本地比价","window":bijiaWindow}, {"name": "平台比价","window":pachongWindow}, {"name": "抓取商品内容"}, {"name": "关闭"}]
# 遍历定义匿名函数绑定按钮点击时间
res = [lambda x,i=i: buttonClicked(i) for i,item in enumerate(button)]
遍历PyQT5按钮绑定到函数
for index,item in enumerate(res): # 循环遍历每个地址,绑定按钮点击事件
button[index]["btn"].clicked.connect(item)