self.grid.addWidget(self.color_combobox, 7, 1, 1, 4)
self.grid.addWidget(self.generate_button, 8, 3, 1, 1)
self.grid.addWidget(self.save_button, 8, 4, 1, 1)
self.setLayout(self.grid)
8.事件绑定
self.generate_button.clicked.connect(self.generate)
self.save_button.clicked.connect(self.save)
9.生成签名
def generate(self):
font2ids_dict = {
‘一笔艺术签’: [‘901’, ‘15’],
‘连笔商务签’: [‘904’, ‘15’],
‘一笔商务签’: [‘905’, ‘14’],
‘真人手写’: [‘343’, ‘14’],
‘卡通趣圆字’: [‘397’, ‘14’],
‘暴躁字’: [‘380’, ‘14’]
}
color2ids_dict = {
‘Black’: [‘#000000’, ‘#FFFFFF’],
‘Blue’: [‘#0000FF’, ‘#FFFFFF’],
‘Red’: [‘#FF0000’, ‘#FFFFFF’],
‘Green’: [‘#00FF00’, ‘#FFFFFF’],
‘Yellow’: [‘#FFFF00’, ‘#FFFFFF’],
‘Pink’: [‘#FFC0CB’, ‘#FFFFFF’],
‘DeepSkyBlue’: [‘#00BFFF’, ‘#FFFFFF’],
‘Cyan’: [‘#00FFFF’, ‘#FFFFFF’],
‘Orange’: [‘#FFA500’, ‘#FFFFFF’],
‘Seashell’: [‘#FFF5EE’, ‘#FFFFFF’]
}
url = ‘http://www.jiqie.com/a/re14.php’
headers = {
‘Referer’: ‘http://www.jiqie.com/a/14.htm’,
‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36’,
‘Host’: ‘www.jiqie.com’,
‘Origin’: ‘http://www.jiqie.com’
}
ids_0 = font2ids_dict[self.font_combobox.currentText()]
ids_1 = color2ids_dict[self.color_combobox.currentText()]
data = {
‘id’: self.name_edit.text(),
‘zhenbi’: ‘20191123’,
‘id1’: ids_0[0],
‘id2’: ids_0[1],
‘id3’: ids_1[0],
‘id5’: ids_1[1]
}
res = requests.post(url, headers=headers, data=data)
image_url = re.findall(r’src=“(.*?)”', r