| 162 | self.setCentralWidget(self.view) |
| 163 | |
| 164 | def initConfigForm(self): |
| 165 | # 创建配置参数窗口 |
| 166 | config_widget = QWidget(self) |
| 167 | config_layout = QVBoxLayout(config_widget) |
| 168 | # 添加文字区域配置 |
| 169 | text_config_label = QLabel('效果配置:') |
| 170 | config_layout.addWidget(text_config_label) |
| 171 | # 选择背景图片 |
| 172 | self.label_bg=QLabel('letter.png') |
| 173 | self.button_bg=QPushButton('选择背景图') |
| 174 | self.button_bg.clicked.connect(self.show_file_dialog) |
| 175 | self.bg_path='./bgs/letter.png' |
| 176 | config_layout.addWidget(self.label_bg) |
| 177 | config_layout.addWidget(self.button_bg) |
| 178 | |
| 179 | creat_bg_layout=QHBoxLayout() |
| 180 | creat_bg_label=QLabel('没有喜欢的背景图片?') |
| 181 | creat_bg_button=QPushButton('创建一个纯色背景') |
| 182 | creat_bg_button.clicked.connect(self.create_bg_widget) |
| 183 | creat_bg_layout.addWidget(creat_bg_label) |
| 184 | creat_bg_layout.addWidget(creat_bg_button) |
| 185 | config_layout.addLayout(creat_bg_layout) |
| 186 | |
| 187 | # 选择字体 |
| 188 | self.label_font = QLabel("选择字体:") |
| 189 | self.combo_box = QComboBox(self) |
| 190 | self.combo_box.addItem('hand.ttf') |
| 191 | self.combo_box.addItem('李国夫董事长手写体.ttf') |
| 192 | self.combo_box.addItem('品如手写体.ttf') |
| 193 | self.combo_box.addItem('青叶手写体.ttf') |
| 194 | self.combo_box.addItem('上首鸿志手写体.ttf') |
| 195 | self.combo_box.addItem('手写大象体.ttf') |
| 196 | self.combo_box.addItem('未知手写体_1.ttf') |
| 197 | self.combo_box.addItem('薛文轩钢笔楷体.ttf') |
| 198 | self.combo_box.addItem('张维镜手写楷书.ttf') |
| 199 | config_layout.addWidget(self.label_font) |
| 200 | config_layout.addWidget(self.combo_box) |
| 201 | self.combo_box.currentIndexChanged.connect(self.updateView) |
| 202 | # 选择字体颜色 |
| 203 | self.label_font_color = QLabel("当前字体颜色:black") |
| 204 | self.button_font_color = QPushButton('选择字体颜色') |
| 205 | self.font_color='black' |
| 206 | config_layout.addWidget(self.label_font_color) |
| 207 | config_layout.addWidget(self.button_font_color) |
| 208 | self.button_font_color.clicked.connect(self.show_color_dialog) |
| 209 | |
| 210 | self.label_text=QLabel('要显示的文字:') |
| 211 | self.text_edit = QTextEdit(self) |
| 212 | self.text_edit.setPlaceholderText('要显示的文字') |
| 213 | self.text_edit.setText('''花费了一天,跟gpt3.5对话进百句,修修改改,最终做成这样的效果。 |
| 214 | 我的字迹一直很差,我也很讨厌写字,我花费了很多时间在练字上但我的字迹不好反坏。所以当我看到生成手写字图片的可能时,我便开始了迫不及待地尝试。 |
| 215 | 做到一半的时候我突然想到网上有没有已经做出来的。确实有,有点小失望,但又细看了一下发现它的应该操作比我的复杂点,所以我又继续做完就是现在的效果。''') |
| 216 | # text_edit.toPlainText() |
| 217 | self.text_edit.textChanged.connect(self.updateView) |
| 218 | config_layout.addWidget(self.label_text) |
| 219 | config_layout.addWidget(self.text_edit) |
| 220 | |
| 221 | # 坐标信息 |