├── Beautify-Camera ├── GUI.ui ├── Hist.png ├── cam.ico ├── haarcascade_frontalface_default.xml ├── main.py ├── window.py └── window2.py ├── Browser ├── browser.py └── images │ ├── a │ ├── arrow-000.png │ ├── arrow-180.png │ ├── arrow-circle-315.png │ ├── cross-circle.png │ ├── cross.png │ ├── disk--arrow.png │ ├── disk--pencil.png │ ├── home.png │ ├── lifebuoy.png │ ├── lock-nossl.png │ ├── lock-ssl.png │ ├── ma-icon-128.png │ ├── ma-icon-256.png │ ├── ma-icon-64.png │ ├── printer.png │ ├── question.png │ └── ui-tab--plus.png ├── Calculator └── calculator.py ├── Image-Edit ├── mainWindow.py └── mainWindowLayout.py ├── MusicPlayer ├── first.ui ├── heart.ico ├── icons │ ├── a │ ├── back.png │ ├── heart.ico │ ├── mute.png │ ├── next.png │ ├── pause.png │ ├── play.png │ ├── stop.png │ └── volume.png ├── main.py └── player.ui ├── NotePad ├── images │ ├── a │ ├── arrow-continue.png │ ├── arrow-curve-180-left.png │ ├── arrow-curve.png │ ├── blue-folder-open-document.png │ ├── clipboard-paste-document-text.png │ ├── disk--pencil.png │ ├── disk.png │ ├── document-copy.png │ ├── printer.png │ ├── question.png │ ├── scissors.png │ ├── selection-input.png │ └── ui-tab--plus.png └── notepad.py ├── PyTunes ├── PyTunes.py ├── icon.icns └── icon.ico ├── README.md ├── RandomPassWord ├── RandomPasswordGenerator.py └── a ├── pyQt5-Calculator_1.jpg ├── pyQt5-Calculator_2.jpg ├── pyQt5-计算器 ├── Calculator_.py ├── a └── calculator.py ├── show_BeautifyCamera.jpg ├── show_Browser.jpg ├── show_Calculator.jpg ├── show_ImageEdit.jpg ├── show_MusicPlayer.jpg ├── show_NotePad.jpg ├── show_Painting.jpg ├── show_PyTunes.jpg ├── show_RandomPassword.jpg └── 绘画 ├── MainWindow.py ├── images ├── a ├── blue-folder-open-image.png ├── border-weight.png ├── cake.png ├── disk.png ├── document-image.png ├── edit-bold.png ├── edit-italic.png ├── edit-underline.png ├── edit.png ├── eraser.png ├── layer-shape-ellipse.png ├── layer-shape-line.png ├── layer-shape-polygon.png ├── layer-shape-polyline.png ├── layer-shape-round.png ├── layer-shape.png ├── magnifier-zoom.png ├── paint-brush.png ├── paint-can-color.png ├── paint-can.png ├── pencil.png ├── pipette.png ├── printer.png ├── selection-poly.png ├── selection.png ├── spray.png └── stamp.png ├── mainwindow.ui ├── paint.py └── stamps ├── a ├── pie-apple.png ├── pie-cherry.png ├── pie-cherry2.png ├── pie-lemon.png ├── pie-moon.png ├── pie-pork.png ├── pie-pumpkin.png └── pie-walnut.png /Beautify-Camera/Hist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Beautify-Camera/Hist.png -------------------------------------------------------------------------------- /Beautify-Camera/cam.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Beautify-Camera/cam.ico -------------------------------------------------------------------------------- /Beautify-Camera/main.py: -------------------------------------------------------------------------------- 1 | from PyQt5 import Qt 2 | from PyQt5 import QtCore,QtWidgets,QtGui 3 | import sys 4 | import PyQt5 5 | from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QFileDialog, QGraphicsRectItem, QGraphicsScene 6 | from PyQt5.QtGui import QPixmap, QImage 7 | from PyQt5.QtCore import QSize 8 | import cv2 9 | import numpy as np 10 | from matplotlib import pyplot as plt 11 | 12 | import window 13 | import window2 14 | 15 | 16 | class MainWindow(): 17 | def __init__(self): 18 | app = QtWidgets.QApplication(sys.argv) 19 | MainWindow = QtWidgets.QMainWindow() 20 | self.raw_image = None 21 | self.ui = window.Ui_MainWindow() 22 | self.ui.setupUi(MainWindow) 23 | self.action_connect() 24 | MainWindow.show() 25 | sys.exit(app.exec_()) 26 | 27 | 28 | # 信号槽绑定 29 | def action_connect(self): 30 | self.ui.action.triggered.connect(self.open_file) 31 | self.ui.action_2.triggered.connect(self.save_file) 32 | self.ui.action_5.triggered.connect(self.recover_img) 33 | # 饱和度 34 | self.ui.horizontalSlider.valueChanged.connect(self.slider_change) 35 | self.ui.horizontalSlider.sliderReleased.connect(self.show_histogram) 36 | 37 | # 亮度 38 | self.ui.horizontalSlider_4.valueChanged.connect(self.slider_change) 39 | self.ui.horizontalSlider_4.sliderReleased.connect(self.show_histogram) 40 | 41 | # 美白(人脸识别) 42 | self.ui.horizontalSlider_8.sliderReleased.connect(self.slider_change) 43 | self.ui.horizontalSlider_8.sliderReleased.connect(self.show_histogram) 44 | 45 | # 美白(皮肤识别) 46 | self.ui.horizontalSlider_13.sliderReleased.connect(self.slider_change) 47 | self.ui.horizontalSlider_13.sliderReleased.connect(self.show_histogram) 48 | 49 | # 磨皮精度 50 | self.ui.horizontalSlider_14.sliderReleased.connect(self.slider_change) 51 | self.ui.horizontalSlider_14.sliderReleased.connect(self.show_histogram) 52 | 53 | # 磨皮程度 54 | self.ui.horizontalSlider_11.sliderReleased.connect(self.slider_change) 55 | self.ui.horizontalSlider_11.sliderReleased.connect(self.show_histogram) 56 | 57 | # 伽马变换 58 | self.ui.horizontalSlider_5.sliderReleased.connect(self.slider_change) 59 | self.ui.horizontalSlider_5.sliderReleased.connect(self.show_histogram) 60 | 61 | # 人脸识别和皮肤检测 62 | self.ui.tabWidget.tabBarClicked.connect(self.calculate) 63 | 64 | # 木刻滤镜 65 | self.ui.horizontalSlider_9.sliderReleased.connect(self.woodcut) 66 | self.ui.horizontalSlider_9.sliderReleased.connect(self.show_histogram) 67 | 68 | # 灰色铅笔画 69 | self.ui.horizontalSlider_7.sliderReleased.connect(self.pencil_gray) 70 | self.ui.horizontalSlider_7.sliderReleased.connect(self.show_histogram) 71 | 72 | # 怀旧滤镜 73 | self.ui.horizontalSlider_10.sliderReleased.connect(self.reminiscene) 74 | self.ui.horizontalSlider_10.sliderReleased.connect(self.show_histogram) 75 | 76 | # 铅笔画滤镜 77 | self.ui.horizontalSlider_12.sliderReleased.connect(self.slider_change) 78 | self.ui.horizontalSlider_12.sliderReleased.connect(self.show_histogram) 79 | 80 | # 风格化 81 | self.ui.horizontalSlider_2.sliderReleased.connect(self.slider_change) 82 | self.ui.horizontalSlider_2.sliderReleased.connect(self.show_histogram) 83 | 84 | # 细节增强 85 | self.ui.horizontalSlider_6.sliderReleased.connect(self.slider_change) 86 | self.ui.horizontalSlider_6.sliderReleased.connect(self.show_histogram) 87 | 88 | # 边缘保持 89 | self.ui.horizontalSlider_3.sliderReleased.connect(self.slider_change) 90 | self.ui.horizontalSlider_3.sliderReleased.connect(self.show_histogram) 91 | 92 | # 打开摄像头 93 | self.ui.action_17.triggered.connect(self.new_camera) 94 | 95 | # 标记人脸位置 96 | self.ui.action_18.triggered.connect(self.mark_face) 97 | 98 | # 显示图片 99 | def show_image(self): 100 | img_cv = cv2.cvtColor(self.current_img, cv2.COLOR_RGB2BGR) 101 | img_width, img_height, a = img_cv.shape 102 | ratio_img = img_width/img_height 103 | ratio_scene = self.ui.graphicsView.width()/self.ui.graphicsView.height() 104 | if ratio_img > ratio_scene: 105 | width = int(self.ui.graphicsView.width()) 106 | height = int(self.ui.graphicsView.width() / ratio_img) 107 | else: 108 | width = int(self.ui.graphicsView.height() * ratio_img) 109 | height = int(self.ui.graphicsView.height()) 110 | img_resize = cv2.resize(img_cv, (height-5, width-5), interpolation=cv2.INTER_AREA) 111 | h, w, c = img_resize.shape 112 | bytesPerLine = w * 3 113 | qimg = QImage(img_resize.data, w, h, bytesPerLine, QImage.Format_RGB888) 114 | self.scene = QGraphicsScene() 115 | pix = QPixmap(qimg) 116 | self.scene.addPixmap(pix) 117 | self.ui.graphicsView.setScene(self.scene) 118 | 119 | # 显示灰度图像 120 | def show_grayimage(self): 121 | img_cv = self.gray_image 122 | img_width, img_height = img_cv.shape 123 | ratio_img = img_width/img_height 124 | ratio_scene = self.ui.graphicsView.width()/self.ui.graphicsView.height() 125 | if ratio_img > ratio_scene: 126 | width = int(self.ui.graphicsView.width()) 127 | height = int(self.ui.graphicsView.width() / ratio_img) 128 | else: 129 | width = int(self.ui.graphicsView.height() * ratio_img) 130 | height = int(self.ui.graphicsView.height()) 131 | img_resize = cv2.resize(img_cv, (height-5, width-5), interpolation=cv2.INTER_AREA) 132 | h, w = img_resize.shape 133 | qimg = QImage(img_resize.data, w, h, w, QImage.Format_Grayscale8) 134 | self.scene = QGraphicsScene() 135 | pix = QPixmap(qimg) 136 | self.scene.addPixmap(pix) 137 | self.ui.graphicsView.setScene(self.scene) 138 | 139 | 140 | # 显示直方图 141 | def show_histogram(self): 142 | if self.raw_image is None: 143 | return 0 144 | img = self.current_img 145 | plt.figure(figsize=((self.ui.tab_3.width()-10)/100, (self.ui.tab_3.width()-60)/100), frameon=False) 146 | plt.hist(img.ravel(), bins=256, range=[0, 256]) 147 | plt.axes().get_yaxis().set_visible(False) 148 | # plt.axes().get_xaxis().set_visible(False) 149 | ax = plt.axes() 150 | # 隐藏坐标系的外围框线 151 | for spine in ax.spines.values(): 152 | spine.set_visible(False) 153 | plt.savefig('Hist.png', bbox_inches="tight", transparent=True, dpi=100) 154 | pix = QPixmap("Hist.png") 155 | self.ui.label.setPixmap(pix) 156 | self.ui.label_2.setPixmap(pix) 157 | self.ui.label_3.setPixmap(pix) 158 | 159 | # 保存图片 160 | def save_file(self): 161 | fname = QFileDialog.getSaveFileName(None, '打开文件', './', ("Images (*.png *.xpm *.jpg)")) 162 | if fname[0]: 163 | cv2.imwrite(fname[0], self.current_img) 164 | 165 | # 打开图片 166 | def open_file(self): 167 | fname = QFileDialog.getOpenFileName(None, '打开文件', './', ("Images (*.png *.xpm *.jpg)")) 168 | if fname[0]: 169 | img_cv = cv2.imdecode(np.fromfile(fname[0], dtype=np.uint8), -1) # 注意这里读取的是RGB空间的 170 | self.raw_image = img_cv 171 | self.last_image = img_cv 172 | self.current_img = img_cv 173 | self.show_image() 174 | self.show_histogram() 175 | self.imgskin = np.zeros(self.raw_image.shape) 176 | self.intial_value() 177 | 178 | # 恢复图片 179 | def recover_img(self): 180 | self.current_img = self.raw_image 181 | self.show_image() 182 | self.show_histogram() 183 | self.intial_value() 184 | 185 | # 饱和度 186 | def change_saturation(self): 187 | if self.raw_image is None: 188 | return 0 189 | 190 | value = self.ui.horizontalSlider.value() 191 | img_hsv = cv2.cvtColor(self.current_img, cv2.COLOR_BGR2HLS) 192 | if value > 2: 193 | img_hsv[:, :, 2] = np.log(img_hsv[:, :, 2] /255* (value - 1)+1) / np.log(value + 1) * 255 194 | if value < 0: 195 | img_hsv[:, :, 2] = np.uint8(img_hsv[:, :, 2] / np.log(- value + np.e)) 196 | self.current_img = cv2.cvtColor(img_hsv, cv2.COLOR_HLS2BGR) 197 | 198 | # 明度调节 199 | def change_darker(self): 200 | if self.raw_image is None: 201 | return 0 202 | value = self.ui.horizontalSlider_4.value() 203 | img_hsv = cv2.cvtColor(self.current_img, cv2.COLOR_BGR2HLS) 204 | if value > 3: 205 | img_hsv[:, :, 1] = np.log(img_hsv[:, :, 1] /255* (value - 1)+1) / np.log(value + 1) * 255 206 | if value < 0: 207 | img_hsv[:, :, 1] = np.uint8(img_hsv[:, :, 1] / np.log(- value + np.e)) 208 | self.last_image = self.current_img 209 | self.current_img = cv2.cvtColor(img_hsv, cv2.COLOR_HLS2BGR) 210 | 211 | # 人脸识别 212 | def detect_face(self): 213 | img = self.raw_image 214 | face_cascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml') 215 | 216 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 217 | faces = face_cascade.detectMultiScale(gray, 1.3, 5) 218 | return faces 219 | 220 | # 皮肤识别 221 | def detect_skin(self): 222 | img = self.raw_image 223 | rows, cols, channals = img.shape 224 | for r in range(rows): 225 | for c in range(cols): 226 | B = img.item(r, c, 0) 227 | G = img.item(r, c, 1) 228 | R = img.item(r, c, 2) 229 | if (abs(R - G) > 15) and (R > G) and (R > B): 230 | if (R > 95) and (G > 40) and (B > 20) and (max(R, G, B) - min(R, G, B) > 15): 231 | self.imgskin[r, c] = (1, 1, 1) 232 | elif (R > 220) and (G > 210) and (B > 170): 233 | self.imgskin[r, c] = (1, 1, 1) 234 | 235 | # 皮肤磨皮(value1精细度,value2程度) 236 | def dermabrasion(self, value1=3, value2=2): 237 | value1 = self.ui.horizontalSlider_14.value() 238 | value2 = 11 - self.ui.horizontalSlider_11.value() 239 | if value1 == 0 and value2 == 0: 240 | return 0 241 | if value2 == 0: 242 | value2 = 2 243 | if value1 == 0: 244 | value1 = 3 245 | img = self.current_img 246 | dx = value1 * 5 247 | fc = value1 * 12.5 248 | p = 50 249 | temp1 = cv2.bilateralFilter(img, dx, fc, fc) 250 | temp2 = (temp1 - img + 128) 251 | temp3 = cv2.GaussianBlur(temp2, (2 * value2 - 1, 2 * value2 - 1), 0, 0) 252 | temp4 = img + 2 * temp3 - 255 253 | dst = np.uint8(img * ((100 - p) / 100) + temp4 * (p / 100)) 254 | 255 | 256 | imgskin_c = np.uint8(-(self.imgskin - 1)) 257 | 258 | dst = np.uint8(dst * self.imgskin + img * imgskin_c) 259 | self.current_img = dst 260 | 261 | # 美白算法(皮肤识别) 262 | def whitening_skin(self, value=30): 263 | # value = 30 264 | value = self.ui.horizontalSlider_13.value() 265 | img = self.current_img 266 | imgw = np.zeros(img.shape, dtype='uint8') 267 | imgw = img.copy() 268 | midtones_add = np.zeros(256) 269 | 270 | for i in range(256): 271 | midtones_add[i] = 0.667 * (1 - ((i - 127.0) / 127) * ((i - 127.0) / 127)) 272 | 273 | lookup = np.zeros(256, dtype="uint8") 274 | 275 | for i in range(256): 276 | red = i 277 | red += np.uint8(value * midtones_add[red]) 278 | red = max(0, min(0xff, red)) 279 | lookup[i] = np.uint8(red) 280 | 281 | 282 | 283 | rows, cols, channals = img.shape 284 | for r in range(rows): 285 | for c in range(cols): 286 | 287 | if self.imgskin[r, c, 0] == 1: 288 | imgw[r, c, 0] = lookup[imgw[r, c, 0]] 289 | imgw[r, c, 1] = lookup[imgw[r, c, 1]] 290 | imgw[r, c, 2] = lookup[imgw[r, c, 2]] 291 | self.current_img = imgw 292 | 293 | # 美白算法(人脸识别) 294 | def whitening_face(self, value=30): 295 | # value = 30 296 | value = self.ui.horizontalSlider_8.value() 297 | img = self.current_img 298 | imgw = np.zeros(img.shape, dtype='uint8') 299 | imgw = img.copy() 300 | midtones_add = np.zeros(256) 301 | 302 | for i in range(256): 303 | midtones_add[i] = 0.667 * (1 - ((i - 127.0) / 127) * ((i - 127.0) / 127)) 304 | 305 | lookup = np.zeros(256, dtype="uint8") 306 | 307 | for i in range(256): 308 | red = i 309 | red += np.uint8(value * midtones_add[red]) 310 | red = max(0, min(0xff, red)) 311 | lookup[i] = np.uint8(red) 312 | 313 | # faces可全局变量 314 | faces = self.faces 315 | 316 | if faces == (): 317 | rows, cols, channals = img.shape 318 | for r in range(rows): 319 | for c in range(cols): 320 | imgw[r, c, 0] = lookup[imgw[r, c, 0]] 321 | imgw[r, c, 1] = lookup[imgw[r, c, 1]] 322 | imgw[r, c, 2] = lookup[imgw[r, c, 2]] 323 | 324 | else: 325 | x, y, w, h = faces[0] 326 | rows, cols, channals = img.shape 327 | x = max(x - (w * np.sqrt(2) - w) / 2, 0) 328 | y = max(y - (h * np.sqrt(2) - h) / 2, 0) 329 | w = w * np.sqrt(2) 330 | h = h * np.sqrt(2) 331 | rows = min(rows, y + h) 332 | cols = min(cols, x + w) 333 | for r in range(int(y), int(rows)): 334 | for c in range(int(x), int(cols)): 335 | imgw[r, c, 0] = lookup[imgw[r, c, 0]] 336 | imgw[r, c, 1] = lookup[imgw[r, c, 1]] 337 | imgw[r, c, 2] = lookup[imgw[r, c, 2]] 338 | 339 | processWidth = int(max(min(rows - y, cols - 1) / 8, 2)) 340 | for i in range(1, processWidth): 341 | alpha = (i - 1) / processWidth 342 | for r in range(int(y), int(rows)): 343 | imgw[r, int(x) + i - 1] = np.uint8( 344 | imgw[r, int(x) + i - 1] * alpha + img[r, int(x) + i - 1] * (1 - alpha)) 345 | imgw[r, int(cols) - i] = np.uint8( 346 | imgw[r, int(cols) - i] * alpha + img[r, int(cols) - i] * (1 - alpha)) 347 | for c in range(int(x) + processWidth, int(cols) - processWidth): 348 | imgw[int(y) + i - 1, c] = np.uint8( 349 | imgw[int(y) + i - 1, c] * alpha + img[int(y) + i - 1, c] * (1 - alpha)) 350 | imgw[int(rows) - i, c] = np.uint8( 351 | imgw[int(rows) - i, c] * alpha + img[int(rows) - i, c] * (1 - alpha)) 352 | self.current_img = imgw 353 | 354 | # Gamma矫正 355 | def gamma_trans(self): 356 | gamma = (self.ui.horizontalSlider_5.value() + 10) / 10 357 | img = self.current_img 358 | gamma_table = [np.power(x / 255.0, gamma) * 255.0 for x in range(256)] 359 | gamma_table = np.round(np.array(gamma_table)).astype(np.uint8) 360 | self.current_img = cv2.LUT(img, gamma_table) 361 | self.show_image() 362 | self.show_histogram() 363 | 364 | # 响应滑动条的变化 365 | def slider_change(self): 366 | if self.raw_image is None: 367 | return 0 368 | 369 | self.current_img = self.raw_image 370 | 371 | # 伽马变换 372 | if self.ui.horizontalSlider_5.value() != 0: 373 | self.gamma_trans() 374 | 375 | # 饱和度 376 | if self.ui.horizontalSlider.value() != 0: 377 | self.change_saturation() 378 | 379 | if self.ui.horizontalSlider_2.value() != 0: 380 | pass 381 | 382 | # 边缘保持 383 | if self.ui.horizontalSlider_3.value() != 0: 384 | self.edge_preserve() 385 | 386 | # 亮度 387 | if self.ui.horizontalSlider_4.value() != 0: 388 | self.change_darker() 389 | 390 | # 美白(人脸识别) 391 | if self.ui.horizontalSlider_8.value() != 0: 392 | self.whitening_face() 393 | 394 | # 美白(皮肤识别) 395 | if self.ui.horizontalSlider_13.value() != 0: 396 | self.whitening_skin() 397 | 398 | # 磨皮程度 399 | if self.ui.horizontalSlider_11.value() != 0: 400 | self.dermabrasion() 401 | 402 | # 磨皮精度 403 | if self.ui.horizontalSlider_14.value() != 0: 404 | self.dermabrasion() 405 | 406 | # 风格化 407 | if self.ui.horizontalSlider_2.value() != 0: 408 | self.stylize() 409 | 410 | # 细节增强 411 | if self.ui.horizontalSlider_6.value() != 0: 412 | self.detail_enhance() 413 | 414 | # 铅笔画 415 | if self.ui.horizontalSlider_12.value() != 0: 416 | self.pencil_color() 417 | self.show_image() 418 | 419 | 420 | # 计算人脸识别和皮肤识别的基本参数 421 | def calculate(self): 422 | if self.raw_image is None: 423 | return 0 424 | if self.calculated is False: 425 | self.faces = self.detect_face() 426 | if self.faces != (): 427 | self.detect_skin() 428 | self.calculated = True 429 | 430 | # 怀旧滤镜 431 | def reminiscene(self): 432 | if self.raw_image is None: 433 | return 0 434 | if self.ui.horizontalSlider_10.value() == 0: 435 | self.current_img = self.raw_image 436 | self.show_image() 437 | return 0 438 | img = self.raw_image.copy() 439 | rows, cols, channals = img.shape 440 | for r in range(rows): 441 | for c in range(cols): 442 | B = img.item(r, c, 0) 443 | G = img.item(r, c, 1) 444 | R = img.item(r, c, 2) 445 | img[r, c, 0] = np.uint8(min(max(0.272 * R + 0.534 * G + 0.131 * B, 0), 255)) 446 | img[r, c, 1] = np.uint8(min(max(0.349 * R + 0.686 * G + 0.168 * B, 0), 255)) 447 | img[r, c, 2] = np.uint8(min(max(0.393 * R + 0.769 * G + 0.189 * B, 0), 255)) 448 | self.current_img = img 449 | self.show_image() 450 | 451 | # 木刻滤镜 452 | def woodcut(self): 453 | if self.raw_image is None: 454 | return 0 455 | if self.ui.horizontalSlider_9.value() == 0: 456 | # self.current_img = self.raw_image 457 | self.show_image() 458 | return 0 459 | self.gray_image = cv2.cvtColor(self.raw_image, cv2.COLOR_BGR2GRAY) 460 | gray = self.gray_image 461 | value = 70 + self.ui.horizontalSlider_9.value() 462 | rows, cols = gray.shape 463 | for r in range(rows): 464 | for c in range(cols): 465 | if gray[r, c] > value: 466 | gray[r, c] = 255 467 | else: 468 | gray[r, c] = 0 469 | self.gray_image = gray 470 | self.show_grayimage() 471 | 472 | # 铅笔画(灰度) 473 | def pencil_gray(self): 474 | if self.raw_image is None: 475 | return 0 476 | if self.ui.horizontalSlider_7.value() == 0: 477 | # self.current_img = self.raw_image 478 | self.show_image() 479 | return 0 480 | value = self.ui.horizontalSlider_7.value() * 0.05 481 | dst1_gray, dst1_color = cv2.pencilSketch(self.current_img, sigma_s=50, sigma_r=value, shade_factor=0.04) 482 | self.gray_image = dst1_gray 483 | self.show_grayimage() 484 | 485 | # 铅笔画(彩色) 486 | def pencil_color(self): 487 | if self.raw_image is None: 488 | return 0 489 | if self.ui.horizontalSlider_12.value() == 0: 490 | self.current_img = self.raw_image 491 | self.show_image() 492 | return 0 493 | value = self.ui.horizontalSlider_12.value() * 0.05 494 | dst1_gray, dst1_color = cv2.pencilSketch(self.current_img, sigma_s=50, sigma_r=value, shade_factor=0.04) 495 | self.current_img = dst1_color 496 | 497 | 498 | # 风格化 499 | def stylize(self): 500 | if self.raw_image is None: 501 | return 0 502 | if self.ui.horizontalSlider_2.value() == 0: 503 | self.current_img = self.raw_image 504 | self.show_image() 505 | return 0 506 | value = self.ui.horizontalSlider_2.value() * 0.05 507 | self.current_img = cv2.stylization(self.current_img, sigma_s=50, sigma_r=value) 508 | 509 | 510 | # 细节增强 511 | def detail_enhance(self): 512 | if self.raw_image is None: 513 | return 0 514 | if self.ui.horizontalSlider_6.value() == 0: 515 | self.current_img = self.raw_image 516 | self.show_image() 517 | return 0 518 | value = self.ui.horizontalSlider_6.value() * 0.05 519 | self.current_img = cv2.detailEnhance(self.current_img, sigma_s=50, sigma_r=value) 520 | 521 | # 边缘保持 522 | def edge_preserve(self): 523 | if self.raw_image is None: 524 | return 0 525 | if self.ui.horizontalSlider_3.value() == 0: 526 | self.current_img = self.raw_image 527 | self.show_image() 528 | return 0 529 | value = self.ui.horizontalSlider_3.value() * 0.05 530 | self.current_img = cv2.edgePreservingFilter(self.current_img, flags=1, sigma_s=50, sigma_r=value) 531 | 532 | # 显示摄像照片 533 | def show_camera(self): 534 | flag, self.camera_image = self.cap.read() 535 | show = cv2.resize(self.image, (640, 480)) 536 | show = cv2.cvtColor(show, cv2.COLOR_BGR2RGB) 537 | showImage = QtGui.QImage(show.data, show.shape[1], show.shape[0], QtGui.QImage.Format_RGB888) 538 | self.label_show_camera.setPixmap(QtGui.QPixmap.fromImage(showImage)) 539 | 540 | # 初始化 541 | def intial_value(self): 542 | self.calculated = False 543 | self.ui.horizontalSlider.setValue(0) 544 | self.ui.horizontalSlider_2.setValue(0) 545 | self.ui.horizontalSlider_3.setValue(0) 546 | self.ui.horizontalSlider_4.setValue(0) 547 | self.ui.horizontalSlider_5.setValue(0) 548 | self.ui.horizontalSlider_6.setValue(0) 549 | self.ui.horizontalSlider_7.setValue(0) 550 | self.ui.horizontalSlider_8.setValue(0) 551 | self.ui.horizontalSlider_9.setValue(0) 552 | self.ui.horizontalSlider_10.setValue(0) 553 | self.ui.horizontalSlider_11.setValue(0) 554 | self.ui.horizontalSlider_12.setValue(0) 555 | self.ui.horizontalSlider_13.setValue(0) 556 | self.ui.horizontalSlider_14.setValue(0) 557 | 558 | # 调用摄像头窗口 559 | def new_camera(self): 560 | Dialog = QtWidgets.QDialog() 561 | self.ui_2 = window2.Ui_Form() 562 | self.ui_2.setupUi(Dialog) 563 | Dialog.show() 564 | self.ui_2.pushButton_2.clicked.connect(self.get_image) 565 | Dialog.exec_() 566 | if self.ui_2.cap.isOpened(): 567 | self.ui_2.cap.release() 568 | if self.ui_2.timer_camera.isActive(): 569 | self.ui_2.timer_camera.stop() 570 | 571 | # 获取摄像头的图片 572 | def get_image(self): 573 | if self.ui_2.captured_image is not None: 574 | self.raw_image = self.ui_2.captured_image 575 | self.current_img = self.ui_2.captured_image 576 | self.show_image() 577 | self.show_histogram() 578 | self.imgskin = np.zeros(self.raw_image.shape) 579 | self.intial_value() 580 | 581 | # 显示人脸识别 582 | def mark_face(self): 583 | if self.raw_image is None: 584 | return 0 585 | if self.calculated == False: 586 | self.calculate() 587 | for (x, y, w, h) in self.faces: 588 | self.current_img = cv2.rectangle(self.current_img.copy(), (x, y), (x+w, y+h), (255, 0, 0), 1) 589 | self.show_image() 590 | 591 | 592 | if __name__ == "__main__": 593 | MainWindow() 594 | -------------------------------------------------------------------------------- /Beautify-Camera/window2.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from PyQt5 import QtCore, QtGui, QtWidgets 4 | import cv2 5 | import sys 6 | 7 | class Ui_Form(object): 8 | def setupUi(self, Form): 9 | self.captured_image = None 10 | self.timer_camera = QtCore.QTimer() 11 | self.cap = cv2.VideoCapture() 12 | Form.setObjectName("Form") 13 | Form.resize(730, 726) 14 | Form.setStyleSheet("background-color: rgb(255, 255, 230);") 15 | self.verticalLayout_3 = QtWidgets.QVBoxLayout(Form) 16 | self.verticalLayout_3.setObjectName("verticalLayout_3") 17 | self.verticalLayout = QtWidgets.QVBoxLayout() 18 | self.verticalLayout.setObjectName("verticalLayout") 19 | self.label = QtWidgets.QLabel(Form) 20 | self.label.setText("") 21 | self.label.setObjectName("label") 22 | self.verticalLayout.addWidget(self.label) 23 | self.horizontalLayout = QtWidgets.QHBoxLayout() 24 | self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) 25 | self.horizontalLayout.setContentsMargins(150, 20, 150, 20) 26 | self.horizontalLayout.setSpacing(150) 27 | self.horizontalLayout.setObjectName("horizontalLayout") 28 | self.pushButton = QtWidgets.QPushButton(Form) 29 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 30 | sizePolicy.setHorizontalStretch(0) 31 | sizePolicy.setVerticalStretch(0) 32 | sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth()) 33 | self.pushButton.setSizePolicy(sizePolicy) 34 | font = QtGui.QFont() 35 | font.setFamily("微软雅黑") 36 | font.setPointSize(14) 37 | self.pushButton.setFont(font) 38 | self.pushButton.setObjectName("pushButton") 39 | self.horizontalLayout.addWidget(self.pushButton) 40 | self.pushButton_2 = QtWidgets.QPushButton(Form) 41 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) 42 | sizePolicy.setHorizontalStretch(0) 43 | sizePolicy.setVerticalStretch(0) 44 | sizePolicy.setHeightForWidth(self.pushButton_2.sizePolicy().hasHeightForWidth()) 45 | self.pushButton_2.setSizePolicy(sizePolicy) 46 | font = QtGui.QFont() 47 | font.setFamily("微软雅黑") 48 | font.setPointSize(14) 49 | self.pushButton_2.setFont(font) 50 | self.pushButton_2.setObjectName("pushButton_2") 51 | self.horizontalLayout.addWidget(self.pushButton_2) 52 | self.horizontalLayout.setStretch(0, 1) 53 | self.horizontalLayout.setStretch(1, 1) 54 | self.verticalLayout.addLayout(self.horizontalLayout) 55 | self.verticalLayout.setStretch(0, 5) 56 | self.verticalLayout.setStretch(1, 1) 57 | self.verticalLayout_3.addLayout(self.verticalLayout) 58 | 59 | self.retranslateUi(Form) 60 | QtCore.QMetaObject.connectSlotsByName(Form) 61 | self.slot_init() 62 | 63 | 64 | def retranslateUi(self, Form): 65 | _translate = QtCore.QCoreApplication.translate 66 | Form.setWindowTitle(_translate("Form", "Form")) 67 | self.pushButton.setText(_translate("Form", "打开摄像头")) 68 | self.pushButton_2.setText(_translate("Form", "拍摄")) 69 | 70 | # 绑定信号 71 | def slot_init(self): 72 | self.pushButton.clicked.connect(self.button_open_camera_click) 73 | self.timer_camera.timeout.connect(self.show_camera) 74 | self.pushButton_2.clicked.connect(self.capture) 75 | 76 | # 打开摄像头 77 | def button_open_camera_click(self): 78 | if self.timer_camera.isActive() == False: 79 | flag = self.cap.open(0) 80 | if flag == False: 81 | msg = QtWidgets.QMessageBox.warning(self, u"Warning", u"没有检测到相机", buttons=QtWidgets.QMessageBox.Ok, defaultButton=QtWidgets.QMessageBox.Ok) 82 | else: 83 | self.timer_camera.start(20) 84 | else: 85 | self.timer_camera.stop() 86 | self.cap.release() 87 | self.label.clear() 88 | 89 | # 显示摄像头 90 | def show_camera(self): 91 | flag, self.image = self.cap.read() 92 | show = cv2.resize(self.image, (700, 500)) 93 | show = cv2.cvtColor(show, cv2.COLOR_BGR2RGB) 94 | showImage = QtGui.QImage(show.data, show.shape[1], show.shape[0], QtGui.QImage.Format_RGB888) 95 | self.label.setPixmap(QtGui.QPixmap.fromImage(showImage)) 96 | 97 | # 拍摄照片 98 | def capture(self): 99 | self.captured_image = self.image 100 | 101 | # 关闭 102 | def closeEvent(self, event): 103 | ok = QtWidgets.QPushButton() 104 | cacel = QtWidgets.QPushButton() 105 | 106 | msg = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning, u"关闭", u"是否关闭!") 107 | 108 | msg.addButton(ok,QtWidgets.QMessageBox.ActionRole) 109 | msg.addButton(cacel, QtWidgets.QMessageBox.RejectRole) 110 | ok.setText(u'确定') 111 | cacel.setText(u'取消') 112 | # msg.setDetailedText('sdfsdff') 113 | if msg.exec_() == QtWidgets.QMessageBox.RejectRole: 114 | event.ignore() 115 | else: 116 | # self.socket_client.send_command(self.socket_client.current_user_command) 117 | if self.cap.isOpened(): 118 | self.cap.release() 119 | if self.timer_camera.isActive(): 120 | self.timer_camera.stop() 121 | event.accept() 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /Browser/browser.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtCore import * 2 | from PyQt5.QtWidgets import * 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtWebEngineWidgets import * 5 | from PyQt5.QtPrintSupport import * 6 | 7 | import os 8 | import sys 9 | 10 | 11 | class AboutDialog(QDialog): 12 | def __init__(self, *args, **kwargs): 13 | super(AboutDialog, self).__init__(*args, **kwargs) 14 | 15 | QBtn = QDialogButtonBox.Ok # No cancel 16 | self.buttonBox = QDialogButtonBox(QBtn) 17 | self.buttonBox.accepted.connect(self.accept) 18 | self.buttonBox.rejected.connect(self.reject) 19 | 20 | layout = QVBoxLayout() 21 | 22 | title = QLabel("CC") 23 | font = title.font() 24 | font.setPointSize(20) 25 | title.setFont(font) 26 | 27 | layout.addWidget(title) 28 | 29 | logo = QLabel() 30 | logo.setPixmap(QPixmap(os.path.join('images', 'ma-icon-128.png'))) 31 | layout.addWidget(logo) 32 | 33 | layout.addWidget(QLabel("Version ")) 34 | layout.addWidget(QLabel("Copyright ")) 35 | 36 | for i in range(0, layout.count()): 37 | layout.itemAt(i).setAlignment(Qt.AlignHCenter) 38 | 39 | layout.addWidget(self.buttonBox) 40 | 41 | self.setLayout(layout) 42 | 43 | 44 | class MainWindow(QMainWindow): 45 | def __init__(self, *args, **kwargs): 46 | super(MainWindow, self).__init__(*args, **kwargs) 47 | 48 | self.browser = QWebEngineView() 49 | self.browser.setUrl(QUrl("http://baidu.com")) 50 | 51 | self.browser.urlChanged.connect(self.update_urlbar) 52 | self.browser.loadFinished.connect(self.update_title) 53 | self.setCentralWidget(self.browser) 54 | 55 | self.status = QStatusBar() 56 | self.setStatusBar(self.status) 57 | 58 | navtb = QToolBar("Navigation") 59 | navtb.setIconSize(QSize(16, 16)) 60 | self.addToolBar(navtb) 61 | 62 | back_btn = QAction(QIcon(os.path.join('images', 'arrow-180.png')), "Back", self) 63 | back_btn.setStatusTip("Back to previous page") 64 | back_btn.triggered.connect(self.browser.back) 65 | navtb.addAction(back_btn) 66 | 67 | next_btn = QAction(QIcon(os.path.join('images', 'arrow-000.png')), "Forward", self) 68 | next_btn.setStatusTip("Forward to next page") 69 | next_btn.triggered.connect(self.browser.forward) 70 | navtb.addAction(next_btn) 71 | 72 | reload_btn = QAction(QIcon(os.path.join('images', 'arrow-circle-315.png')), "Reload", self) 73 | reload_btn.setStatusTip("Reload page") 74 | reload_btn.triggered.connect(self.browser.reload) 75 | navtb.addAction(reload_btn) 76 | 77 | home_btn = QAction(QIcon(os.path.join('images', 'home.png')), "Home", self) 78 | home_btn.setStatusTip("Go home") 79 | home_btn.triggered.connect(self.navigate_home) 80 | navtb.addAction(home_btn) 81 | 82 | navtb.addSeparator() 83 | 84 | self.httpsicon = QLabel() # Yes, really! 85 | self.httpsicon.setPixmap(QPixmap(os.path.join('images', 'lock-nossl.png'))) 86 | navtb.addWidget(self.httpsicon) 87 | 88 | self.urlbar = QLineEdit() 89 | self.urlbar.returnPressed.connect(self.navigate_to_url) 90 | navtb.addWidget(self.urlbar) 91 | 92 | stop_btn = QAction(QIcon(os.path.join('images', 'cross-circle.png')), "Stop", self) 93 | stop_btn.setStatusTip("Stop loading current page") 94 | stop_btn.triggered.connect(self.browser.stop) 95 | navtb.addAction(stop_btn) 96 | 97 | # Uncomment to disable native menubar on Mac 98 | # self.menuBar().setNativeMenuBar(False) 99 | 100 | file_menu = self.menuBar().addMenu("&File") 101 | 102 | open_file_action = QAction(QIcon(os.path.join('images', 'disk--arrow.png')), "Open file...", self) 103 | open_file_action.setStatusTip("Open from file") 104 | open_file_action.triggered.connect(self.open_file) 105 | file_menu.addAction(open_file_action) 106 | 107 | save_file_action = QAction(QIcon(os.path.join('images', 'disk--pencil.png')), "Save Page As...", self) 108 | save_file_action.setStatusTip("Save current page to file") 109 | save_file_action.triggered.connect(self.save_file) 110 | file_menu.addAction(save_file_action) 111 | 112 | print_action = QAction(QIcon(os.path.join('images', 'printer.png')), "Print...", self) 113 | print_action.setStatusTip("Print current page") 114 | print_action.triggered.connect(self.print_page) 115 | file_menu.addAction(print_action) 116 | 117 | help_menu = self.menuBar().addMenu("&Help") 118 | 119 | about_action = QAction(QIcon(os.path.join('images', 'question.png')), "About ", self) 120 | about_action.setStatusTip("Find out more about ") # Hungry! 121 | about_action.triggered.connect(self.about) 122 | help_menu.addAction(about_action) 123 | 124 | navigate_mozarella_action = QAction(QIcon(os.path.join('images', 'lifebuoy.png')), "Homepage", self) 125 | navigate_mozarella_action.setStatusTip("Go to Homepage") 126 | navigate_mozarella_action.triggered.connect(self.navigate_mozarella) 127 | help_menu.addAction(navigate_mozarella_action) 128 | 129 | self.show() 130 | 131 | self.setWindowIcon(QIcon(os.path.join('images', 'ma-icon-64.png'))) 132 | 133 | def update_title(self): 134 | title = self.browser.page().title() 135 | self.setWindowTitle("%s - CC" % title) 136 | 137 | def navigate_mozarella(self): 138 | self.browser.setUrl(QUrl("https://baidu.com")) 139 | 140 | def about(self): 141 | dlg = AboutDialog() 142 | dlg.exec_() 143 | 144 | def open_file(self): 145 | filename, _ = QFileDialog.getOpenFileName(self, "Open file", "", 146 | "Hypertext Markup Language (*.htm *.html);;" 147 | "All files (*.*)") 148 | 149 | if filename: 150 | with open(filename, 'r') as f: 151 | html = f.read() 152 | 153 | self.browser.setHtml(html) 154 | self.urlbar.setText(filename) 155 | 156 | def save_file(self): 157 | filename, _ = QFileDialog.getSaveFileName(self, "Save Page As", "", 158 | "Hypertext Markup Language (*.htm *html);;" 159 | "All files (*.*)") 160 | 161 | if filename: 162 | html = self.browser.page().mainFrame().toHtml() 163 | with open(filename, 'w') as f: 164 | f.write(html) 165 | 166 | def print_page(self): 167 | dlg = QPrintPreviewDialog() 168 | dlg.paintRequested.connect(self.browser.print_) 169 | dlg.exec_() 170 | 171 | def navigate_home(self): 172 | self.browser.setUrl(QUrl("http://www.baidu.com")) 173 | 174 | def navigate_to_url(self): # Does not receive the Url 175 | q = QUrl(self.urlbar.text()) 176 | if q.scheme() == "": 177 | q.setScheme("http") 178 | 179 | self.browser.setUrl(q) 180 | 181 | def update_urlbar(self, q): 182 | 183 | if q.scheme() == 'https': 184 | # Secure padlock icon 185 | self.httpsicon.setPixmap(QPixmap(os.path.join('images', 'lock-ssl.png'))) 186 | 187 | else: 188 | # Insecure padlock icon 189 | self.httpsicon.setPixmap(QPixmap(os.path.join('images', 'lock-nossl.png'))) 190 | 191 | self.urlbar.setText(q.toString()) 192 | self.urlbar.setCursorPosition(0) 193 | 194 | 195 | app = QApplication(sys.argv) 196 | app.setApplicationName("CC") 197 | app.setOrganizationName("CC") 198 | app.setOrganizationDomain("CC.org") 199 | 200 | window = MainWindow() 201 | 202 | app.exec_() 203 | -------------------------------------------------------------------------------- /Browser/images/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Browser/images/arrow-000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/arrow-000.png -------------------------------------------------------------------------------- /Browser/images/arrow-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/arrow-180.png -------------------------------------------------------------------------------- /Browser/images/arrow-circle-315.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/arrow-circle-315.png -------------------------------------------------------------------------------- /Browser/images/cross-circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/cross-circle.png -------------------------------------------------------------------------------- /Browser/images/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/cross.png -------------------------------------------------------------------------------- /Browser/images/disk--arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/disk--arrow.png -------------------------------------------------------------------------------- /Browser/images/disk--pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/disk--pencil.png -------------------------------------------------------------------------------- /Browser/images/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/home.png -------------------------------------------------------------------------------- /Browser/images/lifebuoy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/lifebuoy.png -------------------------------------------------------------------------------- /Browser/images/lock-nossl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/lock-nossl.png -------------------------------------------------------------------------------- /Browser/images/lock-ssl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/lock-ssl.png -------------------------------------------------------------------------------- /Browser/images/ma-icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/ma-icon-128.png -------------------------------------------------------------------------------- /Browser/images/ma-icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/ma-icon-256.png -------------------------------------------------------------------------------- /Browser/images/ma-icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/ma-icon-64.png -------------------------------------------------------------------------------- /Browser/images/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/printer.png -------------------------------------------------------------------------------- /Browser/images/question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/question.png -------------------------------------------------------------------------------- /Browser/images/ui-tab--plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/Browser/images/ui-tab--plus.png -------------------------------------------------------------------------------- /Calculator/calculator.py: -------------------------------------------------------------------------------- 1 | import math 2 | import tkinter 3 | 4 | 5 | root = tkinter.Tk() 6 | root.resizable(width=False, height=False) 7 | '''hypeparameter''' 8 | # 是否按下了运算符 9 | IS_CALC = False 10 | # 存储数字 11 | STORAGE = [] 12 | # 显示框最多显示多少个字符 13 | MAXSHOWLEN = 18 14 | # 当前显示的数字 15 | CurrentShow = tkinter.StringVar() 16 | CurrentShow.set('0') 17 | 18 | 19 | '''按下数字键(0-9)''' 20 | def pressNumber(number): 21 | global IS_CALC 22 | if IS_CALC: 23 | CurrentShow.set('0') 24 | IS_CALC = False 25 | if CurrentShow.get() == '0': 26 | CurrentShow.set(number) 27 | else: 28 | if len(CurrentShow.get()) < MAXSHOWLEN: 29 | CurrentShow.set(CurrentShow.get() + number) 30 | 31 | 32 | '''按下小数点''' 33 | def pressDP(): 34 | global IS_CALC 35 | if IS_CALC: 36 | CurrentShow.set('0') 37 | IS_CALC = False 38 | if len(CurrentShow.get().split('.')) == 1: 39 | if len(CurrentShow.get()) < MAXSHOWLEN: 40 | CurrentShow.set(CurrentShow.get() + '.') 41 | 42 | 43 | '''清零''' 44 | def clearAll(): 45 | global STORAGE 46 | global IS_CALC 47 | STORAGE.clear() 48 | IS_CALC = False 49 | CurrentShow.set('0') 50 | 51 | 52 | '''清除当前显示框内所有数字''' 53 | def clearCurrent(): 54 | CurrentShow.set('0') 55 | 56 | 57 | '''删除显示框内最后一个数字''' 58 | def delOne(): 59 | global IS_CALC 60 | if IS_CALC: 61 | CurrentShow.set('0') 62 | IS_CALC = False 63 | if CurrentShow.get() != '0': 64 | if len(CurrentShow.get()) > 1: 65 | CurrentShow.set(CurrentShow.get()[:-1]) 66 | else: 67 | CurrentShow.set('0') 68 | 69 | 70 | '''计算答案修正''' 71 | def modifyResult(result): 72 | result = str(result) 73 | if len(result) > MAXSHOWLEN: 74 | if len(result.split('.')[0]) > MAXSHOWLEN: 75 | result = 'Overflow' 76 | else: 77 | # 直接舍去不考虑四舍五入问题 78 | result = result[:MAXSHOWLEN] 79 | return result 80 | 81 | 82 | '''按下运算符''' 83 | def pressOperator(operator): 84 | global STORAGE 85 | global IS_CALC 86 | if operator == '+/-': 87 | if CurrentShow.get().startswith('-'): 88 | CurrentShow.set(CurrentShow.get()[1:]) 89 | else: 90 | CurrentShow.set('-'+CurrentShow.get()) 91 | elif operator == '1/x': 92 | try: 93 | result = 1 / float(CurrentShow.get()) 94 | except: 95 | result = 'illegal operation' 96 | result = modifyResult(result) 97 | CurrentShow.set(result) 98 | IS_CALC = True 99 | elif operator == 'sqrt': 100 | try: 101 | result = math.sqrt(float(CurrentShow.get())) 102 | except: 103 | result = 'illegal operation' 104 | result = modifyResult(result) 105 | CurrentShow.set(result) 106 | IS_CALC = True 107 | elif operator == 'MC': 108 | STORAGE.clear() 109 | elif operator == 'MR': 110 | if IS_CALC: 111 | CurrentShow.set('0') 112 | STORAGE.append(CurrentShow.get()) 113 | expression = ''.join(STORAGE) 114 | try: 115 | result = eval(expression) 116 | except: 117 | result = 'illegal operation' 118 | result = modifyResult(result) 119 | CurrentShow.set(result) 120 | IS_CALC = True 121 | elif operator == 'MS': 122 | STORAGE.clear() 123 | STORAGE.append(CurrentShow.get()) 124 | elif operator == 'M+': 125 | STORAGE.append(CurrentShow.get()) 126 | elif operator == 'M-': 127 | if CurrentShow.get().startswith('-'): 128 | STORAGE.append(CurrentShow.get()) 129 | else: 130 | STORAGE.append('-' + CurrentShow.get()) 131 | elif operator in ['+', '-', '*', '/', '%']: 132 | STORAGE.append(CurrentShow.get()) 133 | STORAGE.append(operator) 134 | IS_CALC = True 135 | elif operator == '=': 136 | if IS_CALC: 137 | CurrentShow.set('0') 138 | STORAGE.append(CurrentShow.get()) 139 | expression = ''.join(STORAGE) 140 | try: 141 | result = eval(expression) 142 | # 除以0的情况 143 | except: 144 | result = 'illegal operation' 145 | result = modifyResult(result) 146 | CurrentShow.set(result) 147 | STORAGE.clear() 148 | IS_CALC = True 149 | 150 | 151 | '''Demo''' 152 | def Demo(): 153 | root.minsize(320, 420) 154 | root.title('简易Calculator') 155 | # 布局 156 | # --文本框 157 | label = tkinter.Label(root, textvariable=CurrentShow, bg='black', anchor='e', bd=5, fg='white', font=('楷体', 20)) 158 | label.place(x=20, y=50, width=280, height=50) 159 | # --第一行 160 | # ----Memory clear 161 | button1_1 = tkinter.Button(text='MC', bg='#666', bd=2, command=lambda:pressOperator('MC')) 162 | button1_1.place(x=20, y=110, width=50, height=35) 163 | # ----Memory read 164 | button1_2 = tkinter.Button(text='MR', bg='#666', bd=2, command=lambda:pressOperator('MR')) 165 | button1_2.place(x=77.5, y=110, width=50, height=35) 166 | # ----Memory save 167 | button1_3 = tkinter.Button(text='MS', bg='#666', bd=2, command=lambda:pressOperator('MS')) 168 | button1_3.place(x=135, y=110, width=50, height=35) 169 | # ----Memory + 170 | button1_4 = tkinter.Button(text='M+', bg='#666', bd=2, command=lambda:pressOperator('M+')) 171 | button1_4.place(x=192.5, y=110, width=50, height=35) 172 | # ----Memory - 173 | button1_5 = tkinter.Button(text='M-', bg='#666', bd=2, command=lambda:pressOperator('M-')) 174 | button1_5.place(x=250, y=110, width=50, height=35) 175 | # --第二行 176 | # ----删除单个数字 177 | button2_1 = tkinter.Button(text='del', bg='#666', bd=2, command=lambda:delOne()) 178 | button2_1.place(x=20, y=155, width=50, height=35) 179 | # ----清除当前显示框内所有数字 180 | button2_2 = tkinter.Button(text='CE', bg='#666', bd=2, command=lambda:clearCurrent()) 181 | button2_2.place(x=77.5, y=155, width=50, height=35) 182 | # ----清零(相当于重启) 183 | button2_3 = tkinter.Button(text='C', bg='#666', bd=2, command=lambda:clearAll()) 184 | button2_3.place(x=135, y=155, width=50, height=35) 185 | # ----取反 186 | button2_4 = tkinter.Button(text='+/-', bg='#666', bd=2, command=lambda:pressOperator('+/-')) 187 | button2_4.place(x=192.5, y=155, width=50, height=35) 188 | # ----开根号 189 | button2_5 = tkinter.Button(text='sqrt', bg='#666', bd=2, command=lambda:pressOperator('sqrt')) 190 | button2_5.place(x=250, y=155, width=50, height=35) 191 | # --第三行 192 | # ----7 193 | button3_1 = tkinter.Button(text='7', bg='#bbbbbb', bd=2, command=lambda:pressNumber('7')) 194 | button3_1.place(x=20, y=200, width=50, height=35) 195 | # ----8 196 | button3_2 = tkinter.Button(text='8', bg='#bbbbbb', bd=2, command=lambda:pressNumber('8')) 197 | button3_2.place(x=77.5, y=200, width=50, height=35) 198 | # ----9 199 | button3_3 = tkinter.Button(text='9', bg='#bbbbbb', bd=2, command=lambda:pressNumber('9')) 200 | button3_3.place(x=135, y=200, width=50, height=35) 201 | # ----除 202 | button3_4 = tkinter.Button(text='/', bg='#708069', bd=2, command=lambda:pressOperator('/')) 203 | button3_4.place(x=192.5, y=200, width=50, height=35) 204 | # ----取余 205 | button3_5 = tkinter.Button(text='%', bg='#708069', bd=2, command=lambda:pressOperator('%')) 206 | button3_5.place(x=250, y=200, width=50, height=35) 207 | # --第四行 208 | # ----4 209 | button4_1 = tkinter.Button(text='4', bg='#bbbbbb', bd=2, command=lambda:pressNumber('4')) 210 | button4_1.place(x=20, y=245, width=50, height=35) 211 | # ----5 212 | button4_2 = tkinter.Button(text='5', bg='#bbbbbb', bd=2, command=lambda:pressNumber('5')) 213 | button4_2.place(x=77.5, y=245, width=50, height=35) 214 | # ----6 215 | button4_3 = tkinter.Button(text='6', bg='#bbbbbb', bd=2, command=lambda:pressNumber('6')) 216 | button4_3.place(x=135, y=245, width=50, height=35) 217 | # ----乘 218 | button4_4 = tkinter.Button(text='*', bg='#708069', bd=2, command=lambda:pressOperator('*')) 219 | button4_4.place(x=192.5, y=245, width=50, height=35) 220 | # ----取导数 221 | button4_5 = tkinter.Button(text='1/x', bg='#708069', bd=2, command=lambda:pressOperator('1/x')) 222 | button4_5.place(x=250, y=245, width=50, height=35) 223 | # --第五行 224 | # ----3 225 | button5_1 = tkinter.Button(text='3', bg='#bbbbbb', bd=2, command=lambda:pressNumber('3')) 226 | button5_1.place(x=20, y=290, width=50, height=35) 227 | # ----2 228 | button5_2 = tkinter.Button(text='2', bg='#bbbbbb', bd=2, command=lambda:pressNumber('2')) 229 | button5_2.place(x=77.5, y=290, width=50, height=35) 230 | # ----1 231 | button5_3 = tkinter.Button(text='1', bg='#bbbbbb', bd=2, command=lambda:pressNumber('1')) 232 | button5_3.place(x=135, y=290, width=50, height=35) 233 | # ----减 234 | button5_4 = tkinter.Button(text='-', bg='#708069', bd=2, command=lambda:pressOperator('-')) 235 | button5_4.place(x=192.5, y=290, width=50, height=35) 236 | # ----等于 237 | button5_5 = tkinter.Button(text='=', bg='#708069', bd=2, command=lambda:pressOperator('=')) 238 | button5_5.place(x=250, y=290, width=50, height=80) 239 | # --第六行 240 | # ----0 241 | button6_1 = tkinter.Button(text='0', bg='#bbbbbb', bd=2, command=lambda:pressNumber('0')) 242 | button6_1.place(x=20, y=335, width=107.5, height=35) 243 | # ----小数点 244 | button6_2 = tkinter.Button(text='.', bg='#bbbbbb', bd=2, command=lambda:pressDP()) 245 | button6_2.place(x=135, y=335, width=50, height=35) 246 | # ----加 247 | button6_3 = tkinter.Button(text='+', bg='#708069', bd=2, command=lambda:pressOperator('+')) 248 | button6_3.place(x=192.5, y=335, width=50, height=35) 249 | root.mainloop() 250 | 251 | 252 | if __name__ == '__main__': 253 | Demo() -------------------------------------------------------------------------------- /Image-Edit/mainWindow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | import os 6 | from PyQt5.QtGui import * 7 | from PyQt5.QtCore import * 8 | from PyQt5.QtWidgets import * 9 | from PyQt5 import QtCore, QtGui, QtWidgets 10 | 11 | from mainWindowLayout import MainLayout 12 | 13 | import cv2 14 | import numpy as np 15 | from scipy import * 16 | from matplotlib import pyplot as plt 17 | 18 | class MainWindow(QMainWindow, MainLayout): 19 | imagePaths = [] 20 | originImages=[] 21 | imageList = [] #二维的图像列表 22 | hideLayoutTag=-1 23 | 24 | def __init__(self,parent=None): 25 | super(MainWindow, self).__init__(parent) 26 | self.setupUi(self) 27 | self.signalSlots() 28 | 29 | 30 | #button与具体方法关联 31 | def signalSlots(self): 32 | #文件按钮相关方法 33 | #打开 34 | self.openAct.triggered.connect(lambda : importImage(self)) 35 | #保存 36 | self.saveAct.triggered.connect(lambda : importImage(self)) 37 | #退出 38 | self.exitAct.triggered.connect(self.close) 39 | 40 | #编辑按钮相关方法 41 | #放大 42 | self.largeAct.triggered.connect(lambda : largeImage(self)) 43 | #缩小 44 | self.smallAct.triggered.connect(lambda : smallImage(self)) 45 | #灰度 46 | self.grayAct.triggered.connect(lambda : grayImage(self)) 47 | #亮度 48 | self.brightAct.triggered.connect(lambda : brightImage(self)) 49 | #旋转 50 | self.rotateAct.triggered.connect(lambda : rotateImage(self)) 51 | #截图 52 | self.screenshotAct.triggered.connect(lambda : screenshotImage(self)) 53 | 54 | #变换按钮相关方法 55 | #傅里叶变换 56 | self.change1Act.triggered.connect(lambda : change1Image(self)) 57 | #离散余弦变换 58 | self.change2Act.triggered.connect(lambda : change2Image(self)) 59 | #Radon变换 60 | self.change3Act.triggered.connect(lambda : change3Image(self)) 61 | 62 | #噪声按钮相关方法 63 | #高斯噪声 64 | self.noise1Act.triggered.connect(lambda : noise1Image(self)) 65 | #椒盐噪声 66 | self.noise2Act.triggered.connect(lambda : noise2Image(self)) 67 | #斑点噪声 68 | self.noise3Act.triggered.connect(lambda : importImage(self)) 69 | #泊松噪声 70 | self.noise4Act.triggered.connect(lambda : importImage(self)) 71 | 72 | #滤波按钮相关方法 73 | #高通滤波 74 | self.smoothing1Act.triggered.connect(lambda : smoothing1Image(self)) 75 | #低通滤波 76 | self.smoothing2Act.triggered.connect(lambda : smoothing2Image(self)) 77 | #平滑滤波 78 | self.smoothing3Act.triggered.connect(lambda : smoothing3Image(self)) 79 | #锐化滤波 80 | self.smoothing4Act.triggered.connect(lambda : smoothing4Image(self)) 81 | 82 | #直方图统计按钮相关方法 83 | #R直方图 84 | self.hist1Act.triggered.connect(lambda : hist1Image(self)) 85 | #G直方图 86 | self.hist2Act.triggered.connect(lambda : importImage(self)) 87 | #B直方图 88 | self.hist3Act.triggered.connect(lambda : importImage(self)) 89 | 90 | #图像增强按钮相关方法 91 | #伪彩色增强 92 | self.enhance1Act.triggered.connect(lambda : enhance1Image(self)) 93 | #真彩色增强 94 | self.enhance2Act.triggered.connect(lambda : enhance2Image(self)) 95 | #直方图均衡 96 | self.enhance3Act.triggered.connect(lambda : histNormalized(self)) 97 | #NTSC颜色模型 98 | self.enhance4Act.triggered.connect(lambda : enhance4Image(self)) 99 | #YCbCr颜色模型 100 | self.enhance5Act.triggered.connect(lambda : enhance5Image(self)) 101 | #HSV颜色模型 102 | self.enhance6Act.triggered.connect(lambda : enhance6Image(self)) 103 | 104 | #阈值分割方法 105 | self.threButton.clicked.connect(lambda : threImage(self)) 106 | #形态学处理方法 107 | self.morphologyProcessButton.clicked.connect(lambda : morphologyProcessImage(self)) 108 | #特征提取方法 109 | self.featureButton.clicked.connect(lambda : featureImage(self)) 110 | #图像分类与识别方法 111 | self.imgButton.clicked.connect(lambda : layoutChange(self)) 112 | #底部 113 | #上一张 114 | self.preButton.clicked.connect(lambda : preImage(self)) 115 | #下一张 116 | self.nextButton.clicked.connect(lambda : nextImage(self)) 117 | #退出 118 | self.exitButton.clicked.connect(self.close) 119 | 120 | #编辑按钮相关方法 121 | #放大 122 | def largeImage(window): 123 | imageList=[] 124 | for img in window.originImages: 125 | imgs=[] 126 | img_info=img[0].shape 127 | image_height=img_info[0] 128 | image_weight=img_info[1] 129 | dstHeight=int(2*image_height) 130 | dstWeight=int(2*image_weight) 131 | result=cv2.resize(img[0],(dstHeight,dstWeight)) 132 | imgs.extend([img[0],result]) 133 | imageList.append(imgs) 134 | resizeFromList(window, imageList) 135 | showImage(window,['原图','放大后']) 136 | #缩小 137 | def smallImage(window): 138 | imageList=[] 139 | for img in window.originImages: 140 | imgs=[] 141 | img_info=img[0].shape 142 | image_height=img_info[0] 143 | image_weight=img_info[1] 144 | dstHeight=int(0.5*image_height) 145 | dstWeight=int(0.5*image_weight) 146 | result=cv2.resize(img[0],(dstHeight,dstWeight)) 147 | imgs.extend([img[0],result]) 148 | imageList.append(imgs) 149 | resizeFromList(window, imageList) 150 | showImage(window,['原图','缩小后']) 151 | #灰度 152 | def grayImage(window): 153 | imageList=[] 154 | for img in window.originImages: 155 | imgs=[] 156 | result = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) 157 | imgs.extend([img[0],result]) 158 | imageList.append(imgs) 159 | resizeFromList(window, imageList) 160 | showImage(window,['原图','灰度处理后']) 161 | #亮度 162 | def brightImage(window): 163 | imageList=[] 164 | for img in window.originImages: 165 | imgs=[] 166 | rows, cols, chunnel = img[0].shape 167 | blank = np.zeros([rows, cols, chunnel], img[0].dtype) 168 | result = cv2.addWeighted(img[0], 1.3, blank, 1-1.3, 3) 169 | imgs.extend([img[0],result]) 170 | imageList.append(imgs) 171 | resizeFromList(window, imageList) 172 | showImage(window,['原图','调整亮度后']) 173 | #旋转 174 | def rotateImage(window): 175 | imageList=[] 176 | for img in window.originImages: 177 | imgs=[] 178 | img_info=img[0].shape 179 | image_height=img_info[0] 180 | image_weight=img_info[1] 181 | mat_rotate=cv2.getRotationMatrix2D((image_height*0.5,image_weight*0.5),90,1) #center angle 3scale 182 | result=cv2.warpAffine(img[0],mat_rotate,(image_height,image_weight)) 183 | imgs.extend([img[0],result]) 184 | imageList.append(imgs) 185 | resizeFromList(window, imageList) 186 | showImage(window,['原图','旋转后']) 187 | #截图 188 | def screenshotImage(window): 189 | imageList=[] 190 | for img in window.originImages: 191 | imgs=[] 192 | result = img[0][70:170, 440:540] 193 | imgs.extend([img[0],result]) 194 | imageList.append(imgs) 195 | resizeFromList(window, imageList) 196 | showImage(window,['原图','截图后']) 197 | 198 | #变换按钮相关方法 199 | #傅里叶变换 200 | def change1Image(window): 201 | imageList=[] 202 | for img in window.originImages: 203 | imgs=[] 204 | b,g,r=cv2.split(img[0]) 205 | b_freImg,b_recImg=oneChannelDft(b) 206 | g_freImg, g_recImg = oneChannelDft(g) 207 | r_freImg, r_recImg = oneChannelDft(r) 208 | freImg=cv2.merge([b_freImg,g_freImg,r_freImg]) 209 | imgs.extend([img[0],freImg]) 210 | imageList.append(imgs) 211 | resizeFromList(window, imageList) 212 | showImage(window,['原图','傅里叶变换后']) 213 | def oneChannelDft(img): 214 | width, height = img.shape 215 | nwidth = cv2.getOptimalDFTSize(width) 216 | nheigth = cv2.getOptimalDFTSize(height) 217 | nimg = np.zeros((nwidth, nheigth)) 218 | nimg[:width, :height] = img 219 | dft = cv2.dft(np.float32(nimg), flags=cv2.DFT_COMPLEX_OUTPUT) 220 | ndft = dft[:width, :height] 221 | ndshift = np.fft.fftshift(ndft) 222 | magnitude = np.log(cv2.magnitude(ndshift[:, :, 0], ndshift[:, :, 1])) 223 | result = (magnitude - magnitude.min()) / (magnitude.max() - magnitude.min()) * 255 224 | frequencyImg = result.astype('uint8') 225 | ilmg = cv2.idft(dft) 226 | ilmg = cv2.magnitude(ilmg[:, :, 0], ilmg[:, :, 1])[:width, :height] 227 | ilmg = np.floor((ilmg - ilmg.min()) / (ilmg.max() - ilmg.min()) * 255) 228 | recoveredImg = ilmg.astype('uint8') 229 | return frequencyImg,recoveredImg 230 | 231 | #离散余弦变换 232 | def change2Image(window): 233 | imageList=[] 234 | for img in window.originImages: 235 | imgs=[] 236 | img1 = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) 237 | img_dct = cv2.dct(img1) #进行离散余弦变换 238 | imgs.extend([img[0],img_dct]) 239 | imageList.append(imgs) 240 | resizeFromList(window, imageList) 241 | showImage(window,['原图','离散余弦变换后']) 242 | #Radon变换 243 | def change3Image(window): 244 | imageList=[] 245 | for img in window.originImages: 246 | imgs=[] 247 | img_dct = cv2.dct(img[0]) 248 | result = np.log(abs(img_dct)) 249 | imgs.extend([img[0],result]) 250 | imageList.append(imgs) 251 | resizeFromList(window, imageList) 252 | showImage(window,['原图','Radon变换后']) 253 | 254 | #噪声按钮相关方法 255 | #高斯噪声 256 | #定义添加高斯噪声的函数 257 | def addGaussianNoise(image,percetage): 258 | G_Noiseimg = image 259 | G_NoiseNum=int(percetage*image.shape[0]*image.shape[1]) 260 | for i in range(G_NoiseNum): 261 | temp_x = np.random.randint(20,40) 262 | temp_y = np.random.randint(20,40) 263 | G_Noiseimg[temp_x][temp_y] = 255 264 | return G_Noiseimg 265 | def noise1Image(window): 266 | imageList=[] 267 | for img in window.originImages: 268 | imgs=[] 269 | grayImage = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) #灰度变换 270 | result = addGaussianNoise(grayImage,0.01) #添加10%的高斯噪声 271 | imgs.extend([img[0],result]) 272 | imageList.append(imgs) 273 | resizeFromList(window, imageList) 274 | showImage(window,['原图','高斯噪声后']) 275 | #椒盐噪声 276 | #定义添加椒盐噪声的函数 277 | def saltpepper(img,n): 278 | m=int((img.shape[0]*img.shape[1])*n) 279 | for a in range(m): 280 | i=int(np.random.random()*img.shape[1]) 281 | j=int(np.random.random()*img.shape[0]) 282 | if img.ndim==2: 283 | img[j,i]=255 284 | elif img.ndim==3: 285 | img[j,i,0]=255 286 | img[j,i,1]=255 287 | img[j,i,2]=255 288 | for b in range(m): 289 | i=int(np.random.random()*img.shape[1]) 290 | j=int(np.random.random()*img.shape[0]) 291 | if img.ndim==2: 292 | img[j,i]=0 293 | elif img.ndim==3: 294 | img[j,i,0]=0 295 | img[j,i,1]=0 296 | img[j,i,2]=0 297 | return img 298 | def noise2Image(window): 299 | imageList=[] 300 | for img in window.originImages: 301 | imgs=[] 302 | grayImage = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) #灰度变换 303 | result = saltpepper(grayImage,0.02) 304 | imgs.extend([img[0],result]) 305 | imageList.append(imgs) 306 | resizeFromList(window, imageList) 307 | showImage(window,['原图','椒盐噪声后']) 308 | 309 | #滤波按钮相关方法 310 | #高通滤波 311 | def smoothing1Image(window): 312 | imageList=[] 313 | for img in window.originImages: 314 | imgs=[] 315 | x=cv2.Sobel(img[0],cv2.CV_16S,1,0) 316 | y=cv2.Sobel(img[0],cv2.CV_16S,0,1) 317 | absx=cv2.convertScaleAbs(x) 318 | absy=cv2.convertScaleAbs(y) 319 | result = cv2.addWeighted(absx,0.5,absy,0.5,0) 320 | imgs.extend([img[0],result]) 321 | imageList.append(imgs) 322 | resizeFromList(window, imageList) 323 | showImage(window,['原图','高通滤波后']) 324 | #低通滤波 325 | def smoothing2Image(window): 326 | imageList=[] 327 | for img in window.originImages: 328 | imgs=[] 329 | result = cv2.medianBlur(img[0],5) 330 | imgs.extend([img[0],result]) 331 | imageList.append(imgs) 332 | resizeFromList(window, imageList) 333 | showImage(window,['原图','低通滤波后']) 334 | #平滑滤波 335 | def smoothing3Image(window): 336 | imageList=[] 337 | for img in window.originImages: 338 | imgs=[] 339 | result = cv2.blur(img[0], (5, 5)) 340 | imgs.extend([img[0],result]) 341 | imageList.append(imgs) 342 | resizeFromList(window, imageList) 343 | showImage(window,['原图','平滑滤波后']) 344 | #锐化滤波 345 | def smoothing4Image(window): 346 | imageList=[] 347 | for img in window.originImages: 348 | imgs=[] 349 | result = cv2.bilateralFilter(img[0],9,75,75) 350 | imgs.extend([img[0],result]) 351 | imageList.append(imgs) 352 | resizeFromList(window, imageList) 353 | showImage(window,['原图','锐化滤波后']) 354 | 355 | #直方图统计按钮相关方法 356 | #R直方图 357 | def hist1Image(window): 358 | imageList=[] 359 | for img in window.originImages: 360 | imgs=[] 361 | color = ('b','g','r') 362 | for i,col in enumerate(color): 363 | histr = cv2.calcHist([img[0]],[i],None,[256],[0,256]) 364 | plt.plot(histr,color = col) 365 | plt.xlim([0,256]) 366 | plt.savefig("hist1.jpg") 367 | 368 | result = cv2.imread("hist1.jpg") 369 | imgs.extend([img[0],result]) 370 | imageList.append(imgs) 371 | resizeFromList(window, imageList) 372 | showImage(window,['原图','R直方图后']) 373 | 374 | #图像增强按钮相关方法 375 | #伪彩色增强 376 | def enhance1Image(window): 377 | imageList=[] 378 | 379 | for img in window.originImages: 380 | imgs=[] 381 | grayImage = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) #灰度变换 382 | result = cv2.applyColorMap(grayImage, cv2.COLORMAP_JET) 383 | imgs.extend([img[0],result]) 384 | imageList.append(imgs) 385 | 386 | resizeFromList(window, imageList) 387 | showImage(window,['原图','伪彩色增强后']) 388 | #真彩色增强 389 | def enhance2Image(window): 390 | imageList=[] 391 | 392 | for img in window.originImages: 393 | imgs=[] 394 | grayImage = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) #灰度变换 395 | result = cv2.applyColorMap(grayImage, cv2.COLORMAP_JET) 396 | imgs.extend([img[0],result]) 397 | imageList.append(imgs) 398 | 399 | resizeFromList(window, imageList) 400 | showImage(window,['原图','真彩色增强后']) 401 | #直方图均衡 402 | def histNormalized(window): 403 | imageList=[] 404 | 405 | for img in window.originImages: 406 | imgs=[] 407 | b, g, r = cv2.split(img[0]) 408 | b_equal = cv2.equalizeHist(b) 409 | g_equal = cv2.equalizeHist(g) 410 | r_equal = cv2.equalizeHist(r) 411 | result = cv2.merge([b_equal, g_equal, r_equal]) 412 | imgs.extend([img[0],result]) 413 | imageList.append(imgs) 414 | 415 | resizeFromList(window, imageList) 416 | showImage(window,['原图','直方图均衡化后']) 417 | 418 | #NTSC颜色模型 419 | def enhance4Image(window): 420 | imageList=[] 421 | 422 | for img in window.originImages: 423 | imgs=[] 424 | result = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) 425 | imgs.extend([img[0],result]) 426 | imageList.append(imgs) 427 | 428 | resizeFromList(window, imageList) 429 | showImage(window,['原图','NTSC颜色模型后']) 430 | 431 | #YCbCr颜色模型 432 | def enhance5Image(window): 433 | imageList=[] 434 | 435 | for img in window.originImages: 436 | imgs=[] 437 | result = cv2.cvtColor(img[0], cv2.COLOR_BGR2YCR_CB) 438 | imgs.extend([img[0],result]) 439 | imageList.append(imgs) 440 | 441 | resizeFromList(window, imageList) 442 | showImage(window,['原图','YCbCr颜色模型后']) 443 | 444 | #HSV颜色模型 445 | def enhance6Image(window): 446 | imageList=[] 447 | 448 | for img in window.originImages: 449 | imgs=[] 450 | result = cv2.cvtColor(img[0],cv2.COLOR_BGR2HSV) 451 | imgs.extend([img[0],result]) 452 | imageList.append(imgs) 453 | 454 | resizeFromList(window, imageList) 455 | showImage(window,['原图','HSV颜色模型后']) 456 | 457 | #阈值分割方法 458 | def threImage(window): 459 | imageList=[] 460 | 461 | for img in window.originImages: 462 | imgs=[] 463 | grayImage = cv2.cvtColor(img[0], cv2.COLOR_BGR2RGB) #灰度变换 464 | result = cv2.threshold(grayImage, 127, 255, cv2.THRESH_BINARY) 465 | imgs.extend([img[0],result]) 466 | imageList.append(imgs) 467 | 468 | # resizeFromList(window, imageList) 469 | showImage(window,['原图','阈值分割后']) 470 | 471 | #形态学处理方法 472 | def morphologyProcessImage(window): 473 | imageList=[] 474 | 475 | for img in window.originImages: 476 | imgs=[] 477 | kernel = cv2.getStructuringElement(cv2.MORPH_RECT,(3, 3)) 478 | result = cv2.erode(img[0],kernel) 479 | imgs.extend([img[0],result]) 480 | imageList.append(imgs) 481 | 482 | resizeFromList(window, imageList) 483 | showImage(window,['原图','形态学处理后']) 484 | 485 | #特征提取方法 486 | def featureImage(window): 487 | imageList=[] 488 | 489 | for img in window.originImages: 490 | imgs=[] 491 | img1 = img[0].copy() 492 | gray=cv2.cvtColor(img[0],cv2.COLOR_BGR2GRAY) 493 | gray=np.float32(gray) 494 | dst=cv2.cornerHarris(gray,2,3,0.04) 495 | img[0][dst>0.01*dst.max()]=[0,0,255] 496 | imgs.extend([img1,img[0]]) 497 | imageList.append(imgs) 498 | 499 | resizeFromList(window, imageList) 500 | showImage(window,['原图','特征提取后']) 501 | 502 | 503 | #打开图像 504 | def importImage(window): 505 | fname, _ = QFileDialog.getOpenFileName(window, 'Open file', '.', 'Image Files(*.jpg *.bmp *.png *.jpeg *.rgb *.tif)') 506 | if fname!='': 507 | window.importImageEdit.setText(fname) 508 | window.imagePaths = [] 509 | window.originImages = [] 510 | window.imageList = [] 511 | window.imagePaths.append(fname) 512 | if window.imagePaths!=[]: 513 | readIamge(window) 514 | resizeFromList(window, window.originImages) 515 | showImage(window) 516 | 517 | def readIamge(window): 518 | window.originImages=[] 519 | for path in window.imagePaths: 520 | imgs=[] 521 | # img=cv2.imread(path) 522 | img = cv2.imdecode(np.fromfile(path, dtype=np.uint8), 1) 523 | # img=cv2.cvtColor(img,cv2.COLOR_RGB2BGR) 524 | imgs.append(img) 525 | window.originImages.append(imgs) 526 | 527 | #显示图像 528 | def showImage(window,headers=[]): 529 | window.showImageView.clear() 530 | window.showImageView.setColumnCount(len(window.imageList[0])) 531 | window.showImageView.setRowCount(len(window.imageList)) 532 | 533 | window.showImageView.setShowGrid(False) 534 | window.showImageView.setEditTriggers(QAbstractItemView.NoEditTriggers) 535 | window.showImageView.setHorizontalHeaderLabels(headers) 536 | for x in range(len(window.imageList[0])): 537 | for y in range(len(window.imageList)): 538 | imageView=QGraphicsView() 539 | imageView.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) 540 | imageView.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) 541 | 542 | img=window.imageList[y][x] 543 | img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) 544 | width=img.shape[1] 545 | height=img.shape[0] 546 | 547 | window.showImageView.setColumnWidth(x, width) 548 | window.showImageView.setRowHeight(y, height) 549 | 550 | frame = QImage(img, width, height, QImage.Format_RGB888) 551 | #调用QPixmap命令,建立一个图像存放框 552 | pix = QPixmap.fromImage(frame) 553 | item = QGraphicsPixmapItem(pix) 554 | scene = QGraphicsScene() # 创建场景 555 | scene.addItem(item) 556 | imageView.setScene(scene) 557 | window.showImageView.setCellWidget(y, x, imageView) 558 | 559 | def resizeFromList(window,imageList): 560 | width=600 561 | height=600 562 | window.imageList=[] 563 | for x_pos in range(len(imageList)): 564 | imgs=[] 565 | for img in imageList[x_pos]: 566 | 567 | # image=cv2.resize(img, (width, height)) 568 | image=cv2.resize(img, (width, height), interpolation=cv2.INTER_CUBIC) 569 | imgs.append(image) 570 | window.imageList.append(imgs) 571 | print(len(window.imageList),len(window.imageList[0])) 572 | 573 | if __name__=='__main__': 574 | 575 | app=QApplication(sys.argv) 576 | mw=MainWindow() 577 | mw.show() 578 | sys.exit(app.exec_()) 579 | -------------------------------------------------------------------------------- /Image-Edit/mainWindowLayout.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | from PyQt5.QtGui import * 5 | from PyQt5.QtCore import * 6 | from PyQt5.QtWidgets import * 7 | 8 | from PyQt5 import QtCore, QtGui, QtWidgets 9 | 10 | 11 | class MainLayout(object): 12 | 13 | def setupUi(self,window): 14 | window.resize(1000, 600) 15 | #窗口标题 16 | self.setWindowTitle('数字图像处理') 17 | 18 | self.centralWidget = QtWidgets.QWidget(window) 19 | 20 | #全局布局 21 | mainLayout=QVBoxLayout(self.centralWidget) 22 | self.label = QLabel() 23 | self.show() 24 | 25 | #顶部布局 26 | #顶部固定布局 27 | topLayout=QHBoxLayout() 28 | solidLayout=QHBoxLayout() 29 | self.importImageEdit=QLineEdit() 30 | self.importImageEdit.setFocusPolicy(Qt.NoFocus) 31 | solidLayout.addWidget(self.importImageEdit) 32 | #文件按钮 33 | self.importButton=QPushButton('文件') 34 | solidLayout.addWidget(self.importButton) 35 | filemenu = QMenu(self) 36 | self.openAct = QAction('打开',self) 37 | filemenu.addAction(self.openAct) 38 | self.saveAct = QAction('保存',self) 39 | filemenu.addAction(self.saveAct) 40 | self.exitAct = QAction('退出',self) 41 | filemenu.addAction(self.exitAct) 42 | self.importButton.setMenu(filemenu) 43 | #编辑按钮 44 | self.editButton=QPushButton('编辑') 45 | solidLayout.addWidget(self.editButton) 46 | editmenu = QMenu(self) 47 | self.largeAct = QAction('放大',self) 48 | editmenu.addAction(self.largeAct) 49 | self.smallAct = QAction('缩小',self) 50 | editmenu.addAction(self.smallAct) 51 | self.grayAct = QAction('灰度',self) 52 | editmenu.addAction(self.grayAct) 53 | self.brightAct = QAction('亮度',self) 54 | editmenu.addAction(self.brightAct) 55 | self.rotateAct = QAction('旋转',self) 56 | editmenu.addAction(self.rotateAct) 57 | self.screenshotAct = QAction('截图',self) 58 | editmenu.addAction(self.screenshotAct) 59 | self.editButton.setMenu(editmenu) 60 | #变换按钮 61 | self.changeButton=QPushButton('变换') 62 | solidLayout.addWidget(self.changeButton) 63 | changemenu = QMenu(self) 64 | self.change1Act = QAction('傅里叶变换',self) 65 | changemenu.addAction(self.change1Act) 66 | self.change2Act = QAction('离散余弦变换',self) 67 | changemenu.addAction(self.change2Act) 68 | self.change3Act = QAction('Radon变换',self) 69 | changemenu.addAction(self.change3Act) 70 | self.changeButton.setMenu(changemenu) 71 | #噪声按钮 72 | self.noiseButton=QPushButton('噪声') 73 | solidLayout.addWidget(self.noiseButton) 74 | noisemenu = QMenu(self) 75 | self.noise1Act = QAction('高斯噪声',self) 76 | noisemenu.addAction(self.noise1Act) 77 | self.noise2Act = QAction('椒盐噪声',self) 78 | noisemenu.addAction(self.noise2Act) 79 | self.noise3Act = QAction('斑点噪声',self) 80 | noisemenu.addAction(self.noise3Act) 81 | self.noise4Act = QAction('泊松噪声',self) 82 | noisemenu.addAction(self.noise4Act) 83 | self.noiseButton.setMenu(noisemenu) 84 | #滤波按钮 85 | self.smoothingButton=QPushButton('滤波') 86 | solidLayout.addWidget(self.smoothingButton) 87 | smoothingmenu = QMenu(self) 88 | self.smoothing1Act = QAction('高通滤波',self) 89 | smoothingmenu.addAction(self.smoothing1Act) 90 | self.smoothing2Act = QAction('低通滤波',self) 91 | smoothingmenu.addAction(self.smoothing2Act) 92 | self.smoothing3Act = QAction('平滑滤波',self) 93 | smoothingmenu.addAction(self.smoothing3Act) 94 | self.smoothing4Act = QAction('锐化滤波',self) 95 | smoothingmenu.addAction(self.smoothing4Act) 96 | self.smoothingButton.setMenu(smoothingmenu) 97 | #直方图统计按钮 98 | self.histButton=QPushButton('直方图统计') 99 | solidLayout.addWidget(self.histButton) 100 | histmenu = QMenu(self) 101 | self.hist1Act = QAction('R直方图',self) 102 | histmenu.addAction(self.hist1Act) 103 | self.hist2Act = QAction('G直方图',self) 104 | histmenu.addAction(self.hist2Act) 105 | self.hist3Act = QAction('B直方图',self) 106 | histmenu.addAction(self.hist3Act) 107 | self.histButton.setMenu(histmenu) 108 | #图像增强按钮 109 | self.enhanceButton=QPushButton('图像增强') 110 | solidLayout.addWidget(self.enhanceButton) 111 | enhancemenu = QMenu(self) 112 | self.enhance1Act = QAction('伪彩色增强',self) 113 | enhancemenu.addAction(self.enhance1Act) 114 | self.enhance2Act = QAction('真彩色增强',self) 115 | enhancemenu.addAction(self.enhance2Act) 116 | self.enhance3Act = QAction('直方图均衡',self) 117 | enhancemenu.addAction(self.enhance3Act) 118 | self.enhance4Act = QAction('NTSC颜色模型',self) 119 | enhancemenu.addAction(self.enhance4Act) 120 | self.enhance5Act = QAction('YCbCr颜色模型',self) 121 | enhancemenu.addAction(self.enhance5Act) 122 | self.enhance6Act = QAction('HSV颜色模型',self) 123 | enhancemenu.addAction(self.enhance6Act) 124 | self.enhanceButton.setMenu(enhancemenu) 125 | #阈值分割按钮 126 | self.threButton=QPushButton('阈值分割') 127 | solidLayout.addWidget(self.threButton) 128 | #形态学处理按钮 129 | self.morphologyProcessButton=QPushButton('形态学处理') 130 | solidLayout.addWidget(self.morphologyProcessButton) 131 | #特征提取按钮 132 | self.featureButton=QPushButton('特征提取') 133 | solidLayout.addWidget(self.featureButton) 134 | #图像分类与识别按钮 135 | self.imgButton=QPushButton('图像分类与识别') 136 | solidLayout.addWidget(self.imgButton) 137 | solidLayout.addStretch(1) 138 | topLayout.addLayout(solidLayout) 139 | 140 | #顶部隐藏布局 141 | self.hideLayout=QHBoxLayout() 142 | topLayout.addLayout(self.hideLayout) 143 | mainLayout.addLayout(topLayout) 144 | 145 | #中间布局 146 | midLayout=QHBoxLayout() 147 | self.showImageView=QTableWidget() 148 | midLayout.addWidget(self.showImageView) 149 | mainLayout.addLayout(midLayout) 150 | 151 | #底部布局 152 | bottomLayout=QHBoxLayout() 153 | self.preButton=QPushButton('上一张') 154 | bottomLayout.addWidget(self.preButton) 155 | self.nextButton=QPushButton('下一张') 156 | bottomLayout.addWidget(self.nextButton) 157 | bottomLayout.addStretch(4) 158 | self.exitButton=QPushButton('退出') 159 | bottomLayout.addWidget(self.exitButton) 160 | mainLayout.addLayout(bottomLayout) 161 | 162 | #设置stretch 163 | mainLayout.setStretchFactor(topLayout,1) 164 | mainLayout.setStretchFactor(midLayout,6) 165 | mainLayout.setStretchFactor(bottomLayout,1) 166 | 167 | window.setCentralWidget(self.centralWidget) 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /MusicPlayer/first.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Screen 4 | 5 | 6 | 7 | 0 8 | 0 9 | 799 10 | 312 11 | 12 | 13 | 14 | 15 | 799 16 | 312 17 | 18 | 19 | 20 | 21 | 799 22 | 312 23 | 24 | 25 | 26 | MusicPlayer 27 | 28 | 29 | QToolTip 30 | { 31 | border: 1px solid black; 32 | background-color: #ffa02f; 33 | padding: 1px; 34 | border-radius: 3px; 35 | opacity: 100; 36 | } 37 | 38 | QWidget 39 | { 40 | color: #b1b1b1; 41 | background-color: #323232; 42 | } 43 | 44 | QTreeView, QListView 45 | { 46 | background-color: silver; 47 | margin-left: 5px; 48 | } 49 | 50 | QWidget:item:hover 51 | { 52 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #ca0619); 53 | color: #000000; 54 | } 55 | 56 | QWidget:item:selected 57 | { 58 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 59 | } 60 | 61 | QMenuBar::item 62 | { 63 | background: transparent; 64 | } 65 | 66 | QMenuBar::item:selected 67 | { 68 | background: transparent; 69 | border: 1px solid #ffaa00; 70 | } 71 | 72 | QMenuBar::item:pressed 73 | { 74 | background: #444; 75 | border: 1px solid #000; 76 | background-color: QLinearGradient( 77 | x1:0, y1:0, 78 | x2:0, y2:1, 79 | stop:1 #212121, 80 | stop:0.4 #343434/*, 81 | stop:0.2 #343434, 82 | stop:0.1 #ffaa00*/ 83 | ); 84 | margin-bottom:-1px; 85 | padding-bottom:1px; 86 | } 87 | 88 | QMenu 89 | { 90 | border: 1px solid #000; 91 | } 92 | 93 | QMenu::item 94 | { 95 | padding: 2px 20px 2px 20px; 96 | } 97 | 98 | QMenu::item:selected 99 | { 100 | color: #000000; 101 | } 102 | 103 | QWidget:disabled 104 | { 105 | color: #808080; 106 | background-color: #323232; 107 | } 108 | 109 | QAbstractItemView 110 | { 111 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0.1 #646464, stop: 1 #5d5d5d); 112 | } 113 | 114 | QWidget:focus 115 | { 116 | /*border: 1px solid darkgray;*/ 117 | } 118 | 119 | QLineEdit 120 | { 121 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0 #646464, stop: 1 #5d5d5d); 122 | padding: 1px; 123 | border-style: solid; 124 | border: 1px solid #1e1e1e; 125 | border-radius: 5; 126 | } 127 | 128 | QPushButton 129 | { 130 | color: #b1b1b1; 131 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646); 132 | border-width: 1px; 133 | border-color: #1e1e1e; 134 | border-style: solid; 135 | border-radius: 6; 136 | padding: 3px; 137 | font-size: 12px; 138 | padding-left: 5px; 139 | padding-right: 5px; 140 | min-width: 40px; 141 | } 142 | 143 | QPushButton:pressed 144 | { 145 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525); 146 | } 147 | 148 | QComboBox 149 | { 150 | selection-background-color: #ffaa00; 151 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646); 152 | border-style: solid; 153 | border: 1px solid #1e1e1e; 154 | border-radius: 5; 155 | } 156 | 157 | QComboBox:hover,QPushButton:hover 158 | { 159 | border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 160 | } 161 | 162 | 163 | QComboBox:on 164 | { 165 | padding-top: 3px; 166 | padding-left: 4px; 167 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525); 168 | selection-background-color: #ffaa00; 169 | } 170 | 171 | QComboBox QAbstractItemView 172 | { 173 | border: 2px solid darkgray; 174 | selection-background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 175 | } 176 | 177 | QComboBox::drop-down 178 | { 179 | subcontrol-origin: padding; 180 | subcontrol-position: top right; 181 | width: 15px; 182 | 183 | border-left-width: 0px; 184 | border-left-color: darkgray; 185 | border-left-style: solid; /* just a single line */ 186 | border-top-right-radius: 3px; /* same radius as the QComboBox */ 187 | border-bottom-right-radius: 3px; 188 | } 189 | 190 | QComboBox::down-arrow 191 | { 192 | image: url(:/dark_orange/img/down_arrow.png); 193 | } 194 | 195 | QGroupBox 196 | { 197 | border: 1px solid darkgray; 198 | margin-top: 10px; 199 | } 200 | 201 | QGroupBox:focus 202 | { 203 | border: 1px solid darkgray; 204 | } 205 | 206 | QTextEdit:focus 207 | { 208 | border: 1px solid darkgray; 209 | } 210 | 211 | QScrollBar:horizontal { 212 | border: 1px solid #222222; 213 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848); 214 | height: 7px; 215 | margin: 0px 16px 0 16px; 216 | } 217 | 218 | QScrollBar::handle:horizontal 219 | { 220 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f); 221 | min-height: 20px; 222 | border-radius: 2px; 223 | } 224 | 225 | QScrollBar::add-line:horizontal { 226 | border: 1px solid #1b1b19; 227 | border-radius: 2px; 228 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a); 229 | width: 14px; 230 | subcontrol-position: right; 231 | subcontrol-origin: margin; 232 | } 233 | 234 | QScrollBar::sub-line:horizontal { 235 | border: 1px solid #1b1b19; 236 | border-radius: 2px; 237 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a); 238 | width: 14px; 239 | subcontrol-position: left; 240 | subcontrol-origin: margin; 241 | } 242 | 243 | QScrollBar::right-arrow:horizontal, QScrollBar::left-arrow:horizontal 244 | { 245 | border: 1px solid black; 246 | width: 1px; 247 | height: 1px; 248 | background: white; 249 | } 250 | 251 | QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal 252 | { 253 | background: none; 254 | } 255 | 256 | QScrollBar:vertical 257 | { 258 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848); 259 | width: 7px; 260 | margin: 16px 0 16px 0; 261 | border: 1px solid #222222; 262 | } 263 | 264 | QScrollBar::handle:vertical 265 | { 266 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f); 267 | min-height: 20px; 268 | border-radius: 2px; 269 | } 270 | 271 | QScrollBar::add-line:vertical 272 | { 273 | border: 1px solid #1b1b19; 274 | border-radius: 2px; 275 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 276 | height: 14px; 277 | subcontrol-position: bottom; 278 | subcontrol-origin: margin; 279 | } 280 | 281 | QScrollBar::sub-line:vertical 282 | { 283 | border: 1px solid #1b1b19; 284 | border-radius: 2px; 285 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d7801a, stop: 1 #ffa02f); 286 | height: 14px; 287 | subcontrol-position: top; 288 | subcontrol-origin: margin; 289 | } 290 | 291 | QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical 292 | { 293 | border: 1px solid black; 294 | width: 1px; 295 | height: 1px; 296 | background: white; 297 | } 298 | 299 | 300 | QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical 301 | { 302 | background: none; 303 | } 304 | 305 | QTextEdit 306 | { 307 | background-color: #242424; 308 | } 309 | 310 | QPlainTextEdit 311 | { 312 | background-color: #242424; 313 | } 314 | 315 | QHeaderView::section 316 | { 317 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); 318 | color: white; 319 | padding-left: 4px; 320 | border: 1px solid #6c6c6c; 321 | } 322 | 323 | QCheckBox:disabled 324 | { 325 | color: #414141; 326 | } 327 | 328 | QDockWidget::title 329 | { 330 | text-align: center; 331 | spacing: 3px; /* spacing between items in the tool bar */ 332 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232); 333 | } 334 | 335 | QDockWidget::close-button, QDockWidget::float-button 336 | { 337 | text-align: center; 338 | spacing: 1px; /* spacing between items in the tool bar */ 339 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232); 340 | } 341 | 342 | QDockWidget::close-button:hover, QDockWidget::float-button:hover 343 | { 344 | background: #242424; 345 | } 346 | 347 | QDockWidget::close-button:pressed, QDockWidget::float-button:pressed 348 | { 349 | padding: 1px -1px -1px 1px; 350 | } 351 | 352 | QMainWindow::separator 353 | { 354 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434); 355 | color: white; 356 | padding-left: 4px; 357 | border: 1px solid #4c4c4c; 358 | spacing: 3px; /* spacing between items in the tool bar */ 359 | } 360 | 361 | QMainWindow::separator:hover 362 | { 363 | 364 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #d7801a, stop:0.5 #b56c17 stop:1 #ffa02f); 365 | color: white; 366 | padding-left: 4px; 367 | border: 1px solid #6c6c6c; 368 | spacing: 3px; /* spacing between items in the tool bar */ 369 | } 370 | 371 | QToolBar::handle 372 | { 373 | spacing: 3px; /* spacing between items in the tool bar */ 374 | background: url(:/dark_orange/img/handle.png); 375 | } 376 | 377 | QMenu::separator 378 | { 379 | height: 2px; 380 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434); 381 | color: white; 382 | padding-left: 4px; 383 | margin-left: 10px; 384 | margin-right: 5px; 385 | } 386 | 387 | QProgressBar 388 | { 389 | border: 2px solid grey; 390 | border-radius: 5px; 391 | text-align: center; 392 | } 393 | 394 | QProgressBar::chunk 395 | { 396 | background-color: #d7801a; 397 | width: 2.15px; 398 | margin: 0.5px; 399 | } 400 | 401 | QTabBar::tab { 402 | color: #b1b1b1; 403 | border: 1px solid #444; 404 | border-bottom-style: none; 405 | background-color: #323232; 406 | padding-left: 10px; 407 | padding-right: 10px; 408 | padding-top: 3px; 409 | padding-bottom: 2px; 410 | margin-right: -1px; 411 | } 412 | 413 | QTabWidget::pane { 414 | border: 1px solid #444; 415 | top: 1px; 416 | } 417 | 418 | QTabBar::tab:last 419 | { 420 | margin-right: 0; /* the last selected tab has nothing to overlap with on the right */ 421 | border-top-right-radius: 3px; 422 | } 423 | 424 | QTabBar::tab:first:!selected 425 | { 426 | margin-left: 0px; /* the last selected tab has nothing to overlap with on the right */ 427 | 428 | 429 | border-top-left-radius: 3px; 430 | } 431 | 432 | QTabBar::tab:!selected 433 | { 434 | color: #b1b1b1; 435 | border-bottom-style: solid; 436 | margin-top: 3px; 437 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:.4 #343434); 438 | } 439 | 440 | QTabBar::tab:selected 441 | { 442 | border-top-left-radius: 3px; 443 | border-top-right-radius: 3px; 444 | margin-bottom: 0px; 445 | } 446 | 447 | QTabBar::tab:!selected:hover 448 | { 449 | /*border-top: 2px solid #ffaa00; 450 | padding-bottom: 3px;*/ 451 | border-top-left-radius: 3px; 452 | border-top-right-radius: 3px; 453 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:0.4 #343434, stop:0.2 #343434, stop:0.1 #ffaa00); 454 | } 455 | 456 | QRadioButton::indicator:checked, QRadioButton::indicator:unchecked{ 457 | color: #b1b1b1; 458 | background-color: #323232; 459 | border: 1px solid #b1b1b1; 460 | border-radius: 6px; 461 | } 462 | 463 | QRadioButton::indicator:checked 464 | { 465 | background-color: qradialgradient( 466 | cx: 0.5, cy: 0.5, 467 | fx: 0.5, fy: 0.5, 468 | radius: 1.0, 469 | stop: 0.25 #ffaa00, 470 | stop: 0.3 #323232 471 | ); 472 | } 473 | 474 | QCheckBox::indicator{ 475 | color: #b1b1b1; 476 | background-color: #323232; 477 | border: 1px solid #b1b1b1; 478 | width: 9px; 479 | height: 9px; 480 | } 481 | 482 | QRadioButton::indicator 483 | { 484 | border-radius: 6px; 485 | } 486 | 487 | QRadioButton::indicator:hover, QCheckBox::indicator:hover 488 | { 489 | border: 1px solid #ffaa00; 490 | } 491 | 492 | QCheckBox::indicator:checked 493 | { 494 | image:url(:/dark_orange/img/checkbox.png); 495 | } 496 | 497 | QCheckBox::indicator:disabled, QRadioButton::indicator:disabled 498 | { 499 | border: 1px solid #444; 500 | } 501 | 502 | 503 | QSlider::groove:horizontal { 504 | border: 1px solid #3A3939; 505 | height: 8px; 506 | background: #201F1F; 507 | margin: 2px 0; 508 | border-radius: 2px; 509 | } 510 | 511 | QSlider::handle:horizontal { 512 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, 513 | stop: 0.0 silver, stop: 0.2 #a8a8a8, stop: 1 #727272); 514 | border: 1px solid #3A3939; 515 | width: 14px; 516 | height: 14px; 517 | margin: -4px 0; 518 | border-radius: 2px; 519 | } 520 | 521 | QSlider::groove:vertical { 522 | border: 1px solid #3A3939; 523 | width: 8px; 524 | background: #201F1F; 525 | margin: 0 0px; 526 | border-radius: 2px; 527 | } 528 | 529 | QSlider::handle:vertical { 530 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 silver, 531 | stop: 0.2 #a8a8a8, stop: 1 #727272); 532 | border: 1px solid #3A3939; 533 | width: 14px; 534 | height: 14px; 535 | margin: 0 -4px; 536 | border-radius: 2px; 537 | } 538 | 539 | QAbstractSpinBox { 540 | padding-top: 2px; 541 | padding-bottom: 2px; 542 | border: 1px solid darkgray; 543 | 544 | border-radius: 2px; 545 | min-width: 50px; 546 | } 547 | 548 | 549 | 550 | 551 | 552 | 240 553 | 10 554 | 321 555 | 81 556 | 557 | 558 | 559 | <html><head/><body><p><span style=" font-size:28pt; font-weight:600; color:#e833a9;">M</span><span style=" font-size:28pt; font-weight:600; color:#830fe8;">I</span><span style=" font-size:28pt; font-weight:600; color:#32e832;">U</span><span style=" font-size:28pt; font-weight:600; color:#e833a9;">S</span><span style=" font-size:28pt; font-weight:600; color:#e87837;">C</span><span style=" font-size:28pt; font-weight:600; color:#e833a9;"/><span style=" font-size:28pt; font-weight:600; color:#5500ff;">P</span><span style=" font-size:28pt; font-weight:600; color:#ff55ff;">L</span><span style=" font-size:28pt; font-weight:600; color:#00aaff;">A</span><span style=" font-size:28pt; font-weight:600; color:#aa00ff;">E</span><span style=" font-size:28pt; font-weight:600; color:#ffaa00;">R</span></p></body></html> 560 | 561 | 562 | 563 | 564 | 565 | 270 566 | 90 567 | 271 568 | 181 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | -------------------------------------------------------------------------------- /MusicPlayer/heart.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/heart.ico -------------------------------------------------------------------------------- /MusicPlayer/icons/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /MusicPlayer/icons/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/back.png -------------------------------------------------------------------------------- /MusicPlayer/icons/heart.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/heart.ico -------------------------------------------------------------------------------- /MusicPlayer/icons/mute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/mute.png -------------------------------------------------------------------------------- /MusicPlayer/icons/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/next.png -------------------------------------------------------------------------------- /MusicPlayer/icons/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/pause.png -------------------------------------------------------------------------------- /MusicPlayer/icons/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/play.png -------------------------------------------------------------------------------- /MusicPlayer/icons/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/stop.png -------------------------------------------------------------------------------- /MusicPlayer/icons/volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/MusicPlayer/icons/volume.png -------------------------------------------------------------------------------- /MusicPlayer/main.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | from os.path import expanduser 4 | from PyQt5.QtWidgets import * 5 | from PyQt5.QtMultimedia import * 6 | from PyQt5.QtCore import * 7 | from PyQt5.QtGui import * 8 | from PyQt5.uic import loadUiType 9 | import time 10 | 11 | scriptDir = os.path.dirname(os.path.realpath(__file__)) 12 | SCREEN,_ = loadUiType(os.path.join(os.path.dirname(__file__),"first.ui")) 13 | PLAYER,_ = loadUiType(os.path.join(os.path.dirname(__file__),"player.ui")) 14 | 15 | class Threading(QThread): 16 | mysignal = pyqtSignal(int) 17 | def __init__(self, parent=None): 18 | QThread.__init__(self, parent) 19 | 20 | def run(self): 21 | time.sleep(4) 22 | self.mysignal.emit(1) 23 | 24 | class ThreadAnimation(QThread): 25 | myAnimation = pyqtSignal(int) 26 | def __init__(self, parent=None): 27 | QThread.__init__(self, parent) 28 | self.runs = True 29 | def run(self): 30 | while self.runs: 31 | time.sleep(2) 32 | self.myAnimation.emit(1) 33 | def stop(self): 34 | self.runs = False 35 | 36 | class Screen(QMainWindow, SCREEN): 37 | def __init__(self, parent=None): 38 | super(Screen, self).__init__(parent) 39 | QMainWindow.__init__(self) 40 | self.setWindowIcon(QIcon(scriptDir + os.path.sep + 'icons/heart.ico')) 41 | self.setupUi(self) 42 | pitmap = QPixmap("icons/heart.ico") 43 | self.image.setPixmap(pitmap) 44 | thread = Threading(self) 45 | thread.mysignal.connect(self.onTimeEnd) 46 | thread.start() 47 | 48 | @pyqtSlot(int) 49 | def onTimeEnd(self, value): 50 | self.hide() 51 | window = Player(self) 52 | window.show() 53 | 54 | 55 | class Player(QMainWindow, PLAYER): 56 | def __init__(self, parent=None): 57 | super(Player, self).__init__(parent) 58 | self.setupUi(self) 59 | self.setWindowIcon(QIcon(scriptDir + os.path.sep + 'icons/heart.ico')) 60 | self.play_icon = QIcon("icons/play.png") 61 | self.next_icon = QIcon("icons/next.png") 62 | self.back_icon = QIcon("icons/back.png") 63 | self.pause_icon = QIcon("icons/pause.png") 64 | self.stop_icon = QIcon("icons/stop.png") 65 | self.volume_icon = QIcon("icons/volume.png") 66 | self.mute_icon = QIcon("icons/mute.png") 67 | self.default_image = QPixmap("icons/heart.ico") 68 | self.currentPlaylist = QMediaPlaylist() 69 | self.icon_button() 70 | self.setAcceptDrops(True) 71 | self.sound = True 72 | self.music = {} 73 | self.player = QMediaPlayer(self) 74 | self.player.mediaStatusChanged.connect(self.mediaStatusChange) 75 | self.player.positionChanged.connect(self.positionChanged) 76 | self.player.durationChanged.connect(self.durationChanged) 77 | self.musicList.itemClicked.connect(self.on_item_clicked) 78 | self._buffer = QBuffer() 79 | self.musicProgress.setValue(0) 80 | self.musicProgress.setRange(0, 0) 81 | self.musicProgress.sliderMoved.connect(self.onSliderMoved) 82 | self.musicVolume.valueChanged.connect(self.onVolumeChange) 83 | self.player.setPlaylist(self.currentPlaylist) 84 | self.volumeProgress.clicked.connect(self.onSoundClicked) 85 | self.stopButton.clicked.connect(self.onStopClicked) 86 | self.nextButton.clicked.connect(self.onNextClicked) 87 | self.backButton.clicked.connect(self.onBackClicked) 88 | self.playButton.clicked.connect(self.onPlayClicked) 89 | self.pauseButton.clicked.connect(self.onPauseClicked) 90 | self.musicVolume.setValue(50) 91 | self.index = 0 92 | self.item = "" 93 | self.animation = ThreadAnimation(self) 94 | self.animation.myAnimation.connect(self.startAni) 95 | self.animation.start() 96 | self.aniType = "left" 97 | 98 | def onVolumeChange(self, value): 99 | self.player.setVolume(value) 100 | def onNextClicked(self): 101 | self.player.playlist().next() 102 | index = self.player.playlist().currentIndex() 103 | try: 104 | self.musicList.item(index).setSelected(True) 105 | except: 106 | self.player.playlist().setCurrentIndex(0) 107 | self.musicList.item(0).setSelected(True) 108 | self.player.play() 109 | def onBackClicked(self): 110 | self.player.playlist().previous() 111 | index = self.player.playlist().currentIndex() 112 | try: 113 | self.musicList.item(index).setSelected(True) 114 | except: 115 | self.player.playlist().setCurrentIndex(0) 116 | self.musicList.item(0).setSelected(True) 117 | self.player.play() 118 | 119 | def onPlayClicked(self): 120 | if self.currentPlaylist.mediaCount() == 0: 121 | self.openFile() 122 | return 123 | if self.player.state() == QMediaPlayer.PausedState: 124 | self.player.play() 125 | elif self.player.state() == QMediaPlayer.StoppedState: 126 | self.player.play() 127 | elif self.player.state() == QMediaPlayer.PlayingState: 128 | return 129 | else: 130 | self.player.play() 131 | 132 | def openFile(self): 133 | fileChoosen = QFileDialog.getOpenFileUrl(self, 'Open Music File', expanduser('~'),'Audio (*.mp3 *.ogg *.wav)','*.mp3 *.ogg *.wav') 134 | if fileChoosen != None: 135 | self.musicList.addItem(fileChoosen[0].fileName()) 136 | self.currentPlaylist.addMedia(QMediaContent(fileChoosen[0])) 137 | 138 | def onPauseClicked(self): 139 | if self.player.state() == QMediaPlayer.PausedState: 140 | self.player.play() 141 | elif self.player.state() == QMediaPlayer.StoppedState: 142 | self.player.play() 143 | else: 144 | self.player.pause() 145 | 146 | def onStopClicked(self): 147 | if self.player.state() == QMediaPlayer.PlayingState: 148 | self.player.stop() 149 | elif self.player.state() == QMediaPlayer.PausedState: 150 | self.player.stop() 151 | 152 | def onSoundClicked(self): 153 | if self.sound: 154 | self.volumeProgress.setIcon(self.mute_icon) 155 | self.player.setVolume(0) 156 | self.sound = False 157 | else: 158 | self.sound = True 159 | self.player.setVolume(self.musicVolume.value()) 160 | self.volumeProgress.setIcon(self.volume_icon) 161 | 162 | def durationChanged(self, duration): 163 | self.musicProgress.setRange(0, duration) 164 | 165 | def onSliderMoved(self, position): 166 | sender = self.sender() 167 | if isinstance(sender, QSlider): 168 | if self.player.isSeekable(): 169 | self.player.setPosition(position) 170 | 171 | def on_item_clicked(self, item): 172 | data = self.musicList.selectedIndexes()[0] 173 | index = data.row() 174 | self.playMusic(index=index) 175 | 176 | def playMusic(self, index=0): 177 | self.player.setPlaylist(self.currentPlaylist) 178 | self.player.playlist().setCurrentIndex(index) 179 | self.player.play() 180 | self.player.setVolume(self.musicVolume.value()) 181 | 182 | 183 | def onVolumeChange(self, value): 184 | if value > 50: 185 | self.player.setVolume(value+1) 186 | else: 187 | self.player.setVolume(value) 188 | 189 | def positionChanged(self, position): 190 | tm = '%d:%02d'%(int(position/60000),int((position/1000)%60)) 191 | self.startTime.setText(tm) 192 | self.musicProgress.setValue(position) 193 | 194 | def mediaStatusChange(self): 195 | durationT = self.player.duration() 196 | tm = "%d:%02d"%(int(durationT/60000),int((durationT/1000)%60)) 197 | self.musicTime.setText(tm) 198 | index = self.player.playlist().currentIndex() 199 | try: 200 | self.musicList.item(index).setSelected(True) 201 | except: 202 | pass 203 | 204 | def icon_button(self): 205 | self.playButton.setIcon(self.play_icon) 206 | self.pauseButton.setIcon(self.pause_icon) 207 | self.nextButton.setIcon(self.next_icon) 208 | self.backButton.setIcon(self.back_icon) 209 | self.stopButton.setIcon(self.stop_icon) 210 | self.image.setPixmap(self.default_image) 211 | self.image.setAlignment(Qt.AlignCenter) 212 | self.volumeProgress.setIcon(self.volume_icon) 213 | 214 | 215 | def dropEvent(self, e): 216 | for x in e.mimeData().urls(): 217 | mp3 = x.toString() 218 | name = x.fileName() 219 | path = x.toLocalFile() 220 | self.musicList.addItem(name) 221 | self.currentPlaylist.addMedia(QMediaContent(QUrl.fromLocalFile(path))) 222 | 223 | def dragEnterEvent(self, e): 224 | for x in e.mimeData().urls(): 225 | mp3 = x.toString() 226 | if mp3.endswith(".mp3") or mp3.endswith(".MP3"): 227 | e.accept() 228 | else: 229 | e.ignore() 230 | 231 | def closeEvent(self, event): 232 | reply = QMessageBox.question(self,'Exit?','Are you sure you want to close?',QMessageBox.Yes|QMessageBox.No,QMessageBox.Yes) 233 | if reply == QMessageBox.Yes : 234 | qApp.quit() 235 | else : 236 | try: 237 | event.ignore() 238 | except AttributeError: 239 | pass 240 | 241 | @pyqtSlot(int) 242 | def startAni(self, i): 243 | anim = QPropertyAnimation(self.image, b"geometry") 244 | anim.setDuration(30) 245 | if self.aniType == "left": 246 | anim.setStartValue(QRect(180, 100, 411, 271)) 247 | anim.setEndValue(QRect(190, 110, 420, 280)) 248 | self.aniType = "right" 249 | elif self.aniType == "right": 250 | anim.setStartValue(QRect(190, 110, 420, 280)) 251 | anim.setEndValue(QRect(180, 100, 411, 271)) 252 | self.aniType = "dort" 253 | elif self.aniType == "dort": 254 | anim.setStartValue(QRect(180, 100, 411, 271)) 255 | anim.setEndValue(QRect(122, 302, 395, 261)) 256 | self.aniType = "left" 257 | anim.start() 258 | 259 | if __name__ == "__main__": 260 | app=QApplication(sys.argv) 261 | window = Screen() 262 | window.show() 263 | app.exec_() 264 | -------------------------------------------------------------------------------- /MusicPlayer/player.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 976 10 | 602 11 | 12 | 13 | 14 | 15 | 976 16 | 602 17 | 18 | 19 | 20 | 21 | 976 22 | 602 23 | 24 | 25 | 26 | MusicPlayer 27 | 28 | 29 | QToolTip 30 | { 31 | border: 1px solid black; 32 | background-color: #ffa02f; 33 | padding: 1px; 34 | border-radius: 3px; 35 | opacity: 100; 36 | } 37 | 38 | QWidget 39 | { 40 | color: #b1b1b1; 41 | background-color: #323232; 42 | } 43 | 44 | QTreeView, QListView 45 | { 46 | background-color: silver; 47 | margin-left: 5px; 48 | } 49 | 50 | QWidget:item:hover 51 | { 52 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #ca0619); 53 | color: #000000; 54 | } 55 | 56 | QWidget:item:selected 57 | { 58 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 59 | } 60 | 61 | QMenuBar::item 62 | { 63 | background: transparent; 64 | } 65 | 66 | QMenuBar::item:selected 67 | { 68 | background: transparent; 69 | border: 1px solid #ffaa00; 70 | } 71 | 72 | QMenuBar::item:pressed 73 | { 74 | background: #444; 75 | border: 1px solid #000; 76 | background-color: QLinearGradient( 77 | x1:0, y1:0, 78 | x2:0, y2:1, 79 | stop:1 #212121, 80 | stop:0.4 #343434/*, 81 | stop:0.2 #343434, 82 | stop:0.1 #ffaa00*/ 83 | ); 84 | margin-bottom:-1px; 85 | padding-bottom:1px; 86 | } 87 | 88 | QMenu 89 | { 90 | border: 1px solid #000; 91 | } 92 | 93 | QMenu::item 94 | { 95 | padding: 2px 20px 2px 20px; 96 | } 97 | 98 | QMenu::item:selected 99 | { 100 | color: #000000; 101 | } 102 | 103 | QWidget:disabled 104 | { 105 | color: #808080; 106 | background-color: #323232; 107 | } 108 | 109 | QAbstractItemView 110 | { 111 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0.1 #646464, stop: 1 #5d5d5d); 112 | } 113 | 114 | QWidget:focus 115 | { 116 | /*border: 1px solid darkgray;*/ 117 | } 118 | 119 | QLineEdit 120 | { 121 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4d4d4d, stop: 0 #646464, stop: 1 #5d5d5d); 122 | padding: 1px; 123 | border-style: solid; 124 | border: 1px solid #1e1e1e; 125 | border-radius: 5; 126 | } 127 | 128 | QPushButton 129 | { 130 | color: #b1b1b1; 131 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646); 132 | border-width: 1px; 133 | border-color: #1e1e1e; 134 | border-style: solid; 135 | border-radius: 6; 136 | padding: 3px; 137 | font-size: 12px; 138 | padding-left: 5px; 139 | padding-right: 5px; 140 | min-width: 40px; 141 | } 142 | 143 | QPushButton:pressed 144 | { 145 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525); 146 | } 147 | 148 | QComboBox 149 | { 150 | selection-background-color: #ffaa00; 151 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #565656, stop: 0.1 #525252, stop: 0.5 #4e4e4e, stop: 0.9 #4a4a4a, stop: 1 #464646); 152 | border-style: solid; 153 | border: 1px solid #1e1e1e; 154 | border-radius: 5; 155 | } 156 | 157 | QComboBox:hover,QPushButton:hover 158 | { 159 | border: 2px solid QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 160 | } 161 | 162 | 163 | QComboBox:on 164 | { 165 | padding-top: 3px; 166 | padding-left: 4px; 167 | background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #2d2d2d, stop: 0.1 #2b2b2b, stop: 0.5 #292929, stop: 0.9 #282828, stop: 1 #252525); 168 | selection-background-color: #ffaa00; 169 | } 170 | 171 | QComboBox QAbstractItemView 172 | { 173 | border: 2px solid darkgray; 174 | selection-background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 175 | } 176 | 177 | QComboBox::drop-down 178 | { 179 | subcontrol-origin: padding; 180 | subcontrol-position: top right; 181 | width: 15px; 182 | 183 | border-left-width: 0px; 184 | border-left-color: darkgray; 185 | border-left-style: solid; /* just a single line */ 186 | border-top-right-radius: 3px; /* same radius as the QComboBox */ 187 | border-bottom-right-radius: 3px; 188 | } 189 | 190 | QComboBox::down-arrow 191 | { 192 | image: url(:/dark_orange/img/down_arrow.png); 193 | } 194 | 195 | QGroupBox 196 | { 197 | border: 1px solid darkgray; 198 | margin-top: 10px; 199 | } 200 | 201 | QGroupBox:focus 202 | { 203 | border: 1px solid darkgray; 204 | } 205 | 206 | QTextEdit:focus 207 | { 208 | border: 1px solid darkgray; 209 | } 210 | 211 | QScrollBar:horizontal { 212 | border: 1px solid #222222; 213 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848); 214 | height: 7px; 215 | margin: 0px 16px 0 16px; 216 | } 217 | 218 | QScrollBar::handle:horizontal 219 | { 220 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f); 221 | min-height: 20px; 222 | border-radius: 2px; 223 | } 224 | 225 | QScrollBar::add-line:horizontal { 226 | border: 1px solid #1b1b19; 227 | border-radius: 2px; 228 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a); 229 | width: 14px; 230 | subcontrol-position: right; 231 | subcontrol-origin: margin; 232 | } 233 | 234 | QScrollBar::sub-line:horizontal { 235 | border: 1px solid #1b1b19; 236 | border-radius: 2px; 237 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #ffa02f, stop: 1 #d7801a); 238 | width: 14px; 239 | subcontrol-position: left; 240 | subcontrol-origin: margin; 241 | } 242 | 243 | QScrollBar::right-arrow:horizontal, QScrollBar::left-arrow:horizontal 244 | { 245 | border: 1px solid black; 246 | width: 1px; 247 | height: 1px; 248 | background: white; 249 | } 250 | 251 | QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal 252 | { 253 | background: none; 254 | } 255 | 256 | QScrollBar:vertical 257 | { 258 | background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0, stop: 0.0 #121212, stop: 0.2 #282828, stop: 1 #484848); 259 | width: 7px; 260 | margin: 16px 0 16px 0; 261 | border: 1px solid #222222; 262 | } 263 | 264 | QScrollBar::handle:vertical 265 | { 266 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 0.5 #d7801a, stop: 1 #ffa02f); 267 | min-height: 20px; 268 | border-radius: 2px; 269 | } 270 | 271 | QScrollBar::add-line:vertical 272 | { 273 | border: 1px solid #1b1b19; 274 | border-radius: 2px; 275 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ffa02f, stop: 1 #d7801a); 276 | height: 14px; 277 | subcontrol-position: bottom; 278 | subcontrol-origin: margin; 279 | } 280 | 281 | QScrollBar::sub-line:vertical 282 | { 283 | border: 1px solid #1b1b19; 284 | border-radius: 2px; 285 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d7801a, stop: 1 #ffa02f); 286 | height: 14px; 287 | subcontrol-position: top; 288 | subcontrol-origin: margin; 289 | } 290 | 291 | QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical 292 | { 293 | border: 1px solid black; 294 | width: 1px; 295 | height: 1px; 296 | background: white; 297 | } 298 | 299 | 300 | QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical 301 | { 302 | background: none; 303 | } 304 | 305 | QTextEdit 306 | { 307 | background-color: #242424; 308 | } 309 | 310 | QPlainTextEdit 311 | { 312 | background-color: #242424; 313 | } 314 | 315 | QHeaderView::section 316 | { 317 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #616161, stop: 0.5 #505050, stop: 0.6 #434343, stop:1 #656565); 318 | color: white; 319 | padding-left: 4px; 320 | border: 1px solid #6c6c6c; 321 | } 322 | 323 | QCheckBox:disabled 324 | { 325 | color: #414141; 326 | } 327 | 328 | QDockWidget::title 329 | { 330 | text-align: center; 331 | spacing: 3px; /* spacing between items in the tool bar */ 332 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232); 333 | } 334 | 335 | QDockWidget::close-button, QDockWidget::float-button 336 | { 337 | text-align: center; 338 | spacing: 1px; /* spacing between items in the tool bar */ 339 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #323232, stop: 0.5 #242424, stop:1 #323232); 340 | } 341 | 342 | QDockWidget::close-button:hover, QDockWidget::float-button:hover 343 | { 344 | background: #242424; 345 | } 346 | 347 | QDockWidget::close-button:pressed, QDockWidget::float-button:pressed 348 | { 349 | padding: 1px -1px -1px 1px; 350 | } 351 | 352 | QMainWindow::separator 353 | { 354 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434); 355 | color: white; 356 | padding-left: 4px; 357 | border: 1px solid #4c4c4c; 358 | spacing: 3px; /* spacing between items in the tool bar */ 359 | } 360 | 361 | QMainWindow::separator:hover 362 | { 363 | 364 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #d7801a, stop:0.5 #b56c17 stop:1 #ffa02f); 365 | color: white; 366 | padding-left: 4px; 367 | border: 1px solid #6c6c6c; 368 | spacing: 3px; /* spacing between items in the tool bar */ 369 | } 370 | 371 | QToolBar::handle 372 | { 373 | spacing: 3px; /* spacing between items in the tool bar */ 374 | background: url(:/dark_orange/img/handle.png); 375 | } 376 | 377 | QMenu::separator 378 | { 379 | height: 2px; 380 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:0 #161616, stop: 0.5 #151515, stop: 0.6 #212121, stop:1 #343434); 381 | color: white; 382 | padding-left: 4px; 383 | margin-left: 10px; 384 | margin-right: 5px; 385 | } 386 | 387 | QProgressBar 388 | { 389 | border: 2px solid grey; 390 | border-radius: 5px; 391 | text-align: center; 392 | } 393 | 394 | QProgressBar::chunk 395 | { 396 | background-color: #d7801a; 397 | width: 2.15px; 398 | margin: 0.5px; 399 | } 400 | 401 | QTabBar::tab { 402 | color: #b1b1b1; 403 | border: 1px solid #444; 404 | border-bottom-style: none; 405 | background-color: #323232; 406 | padding-left: 10px; 407 | padding-right: 10px; 408 | padding-top: 3px; 409 | padding-bottom: 2px; 410 | margin-right: -1px; 411 | } 412 | 413 | QTabWidget::pane { 414 | border: 1px solid #444; 415 | top: 1px; 416 | } 417 | 418 | QTabBar::tab:last 419 | { 420 | margin-right: 0; /* the last selected tab has nothing to overlap with on the right */ 421 | border-top-right-radius: 3px; 422 | } 423 | 424 | QTabBar::tab:first:!selected 425 | { 426 | margin-left: 0px; /* the last selected tab has nothing to overlap with on the right */ 427 | 428 | 429 | border-top-left-radius: 3px; 430 | } 431 | 432 | QTabBar::tab:!selected 433 | { 434 | color: #b1b1b1; 435 | border-bottom-style: solid; 436 | margin-top: 3px; 437 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:.4 #343434); 438 | } 439 | 440 | QTabBar::tab:selected 441 | { 442 | border-top-left-radius: 3px; 443 | border-top-right-radius: 3px; 444 | margin-bottom: 0px; 445 | } 446 | 447 | QTabBar::tab:!selected:hover 448 | { 449 | /*border-top: 2px solid #ffaa00; 450 | padding-bottom: 3px;*/ 451 | border-top-left-radius: 3px; 452 | border-top-right-radius: 3px; 453 | background-color: QLinearGradient(x1:0, y1:0, x2:0, y2:1, stop:1 #212121, stop:0.4 #343434, stop:0.2 #343434, stop:0.1 #ffaa00); 454 | } 455 | 456 | QRadioButton::indicator:checked, QRadioButton::indicator:unchecked{ 457 | color: #b1b1b1; 458 | background-color: #323232; 459 | border: 1px solid #b1b1b1; 460 | border-radius: 6px; 461 | } 462 | 463 | QRadioButton::indicator:checked 464 | { 465 | background-color: qradialgradient( 466 | cx: 0.5, cy: 0.5, 467 | fx: 0.5, fy: 0.5, 468 | radius: 1.0, 469 | stop: 0.25 #ffaa00, 470 | stop: 0.3 #323232 471 | ); 472 | } 473 | 474 | QCheckBox::indicator{ 475 | color: #b1b1b1; 476 | background-color: #323232; 477 | border: 1px solid #b1b1b1; 478 | width: 9px; 479 | height: 9px; 480 | } 481 | 482 | QRadioButton::indicator 483 | { 484 | border-radius: 6px; 485 | } 486 | 487 | QRadioButton::indicator:hover, QCheckBox::indicator:hover 488 | { 489 | border: 1px solid #ffaa00; 490 | } 491 | 492 | QCheckBox::indicator:checked 493 | { 494 | image:url(:/dark_orange/img/checkbox.png); 495 | } 496 | 497 | QCheckBox::indicator:disabled, QRadioButton::indicator:disabled 498 | { 499 | border: 1px solid #444; 500 | } 501 | 502 | 503 | QSlider::groove:horizontal { 504 | border: 1px solid #3A3939; 505 | height: 8px; 506 | background: #201F1F; 507 | margin: 2px 0; 508 | border-radius: 2px; 509 | } 510 | 511 | QSlider::handle:horizontal { 512 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, 513 | stop: 0.0 silver, stop: 0.2 #a8a8a8, stop: 1 #727272); 514 | border: 1px solid #3A3939; 515 | width: 14px; 516 | height: 14px; 517 | margin: -4px 0; 518 | border-radius: 2px; 519 | } 520 | 521 | QSlider::groove:vertical { 522 | border: 1px solid #3A3939; 523 | width: 8px; 524 | background: #201F1F; 525 | margin: 0 0px; 526 | border-radius: 2px; 527 | } 528 | 529 | QSlider::handle:vertical { 530 | background: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 silver, 531 | stop: 0.2 #a8a8a8, stop: 1 #727272); 532 | border: 1px solid #3A3939; 533 | width: 14px; 534 | height: 14px; 535 | margin: 0 -4px; 536 | border-radius: 2px; 537 | } 538 | 539 | QAbstractSpinBox { 540 | padding-top: 2px; 541 | padding-bottom: 2px; 542 | border: 1px solid darkgray; 543 | 544 | border-radius: 2px; 545 | min-width: 50px; 546 | } 547 | 548 | 549 | 550 | 551 | 552 | 740 553 | 70 554 | 221 555 | 521 556 | 557 | 558 | 559 | 560 | 561 | 562 | 10 563 | 10 564 | 951 565 | 51 566 | 567 | 568 | 569 | background-color: #323232; 570 | color: #b1b1b1; 571 | border: 1px solid black; 572 | border-radius: 3px; 573 | 574 | 575 | <html><head/><body><p align="center">Welcome To MusicPlayer</p></body></html> 576 | 577 | 578 | 579 | 580 | 581 | 180 582 | 100 583 | 411 584 | 271 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 80 595 | 440 596 | 601 597 | 22 598 | 599 | 600 | 601 | /*Horizontales*/ 602 | QSlider::groove:horizontal{ 603 | border: 1px solid #637EB8; 604 | background: white; 605 | height: 7px; 606 | border-radius: 3px; 607 | } 608 | QSlider::sub-page:horizontal { 609 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, 610 | stop: 0 #ABC7EC, stop: 1 #154A98); 611 | border: 1px solid #777; 612 | height: 10px; 613 | border-radius: 4px; 614 | } 615 | QSlider::add-page:horizontal { 616 | background: #fff; 617 | border: 1px solid #154A98; 618 | height: 10px; 619 | border-radius: 4px; 620 | } 621 | QSlider::handle:horizontal{ 622 | background: qlineargradient(x1:0, y1:0, x2:1, y2:1, 623 | stop:0 #fff, stop:1 #ABC7EC); 624 | border: 1px solid #777; 625 | width: 5px; 626 | margin-top: -4px; 627 | margin-bottom: -4px; 628 | border-radius: 2px; 629 | } 630 | 631 | /*Verticales*/ 632 | QSlider::groove:vertical{ 633 | border: 1px solid #637EB8; 634 | background: white; 635 | width:7px; 636 | height: 55px; 637 | border-radius: 3px; 638 | } 639 | QSlider::add-page:vertical { 640 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, 641 | stop: 0 #ABC7EC, stop: 1 #154A98); 642 | border: 1px solid #154A98; 643 | width: 10px; 644 | border-radius: 4px; 645 | } 646 | QSlider::sub-page:vertical { 647 | background: #fff; 648 | border: 1px solid #777; 649 | width: 7px; 650 | border-radius: 4px; 651 | } 652 | QSlider::handle:vertical{ 653 | background: qlineargradient(x1:0, y1:0, x2:1, y2:1, 654 | stop:0 #fff, stop:1 #ABC7EC); 655 | border: 1px solid #777; 656 | height: 5px; 657 | margin-left: -4px; 658 | margin-right: -4px; 659 | border-radius: 2px; 660 | } 661 | /*Horizontales y Verticales*/ 662 | QSlider::handle:horizontal:hover, 663 | QSlider::handle:vertical:hover{ 664 | border: 1px solid #154A98; 665 | border-radius: 3px; 666 | } 667 | 668 | 669 | Qt::Horizontal 670 | 671 | 672 | 673 | 674 | 675 | 30 676 | 440 677 | 41 678 | 21 679 | 680 | 681 | 682 | 00:00 683 | 684 | 685 | 686 | 687 | 688 | 690 689 | 440 690 | 41 691 | 21 692 | 693 | 694 | 695 | 00:00 696 | 697 | 698 | 699 | 700 | 701 | 350 702 | 490 703 | 71 704 | 61 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 490 718 | 510 719 | 81 720 | 31 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 200 731 | 510 732 | 81 733 | 31 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 430 744 | 500 745 | 52 746 | 41 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 290 757 | 500 758 | 52 759 | 41 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 20 770 | 480 771 | 141 772 | 22 773 | 774 | 775 | 776 | Qt::Horizontal 777 | 778 | 779 | 780 | 781 | 782 | 30 783 | 507 784 | 61 785 | 41 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | -------------------------------------------------------------------------------- /NotePad/images/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /NotePad/images/arrow-continue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/arrow-continue.png -------------------------------------------------------------------------------- /NotePad/images/arrow-curve-180-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/arrow-curve-180-left.png -------------------------------------------------------------------------------- /NotePad/images/arrow-curve.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/arrow-curve.png -------------------------------------------------------------------------------- /NotePad/images/blue-folder-open-document.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/blue-folder-open-document.png -------------------------------------------------------------------------------- /NotePad/images/clipboard-paste-document-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/clipboard-paste-document-text.png -------------------------------------------------------------------------------- /NotePad/images/disk--pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/disk--pencil.png -------------------------------------------------------------------------------- /NotePad/images/disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/disk.png -------------------------------------------------------------------------------- /NotePad/images/document-copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/document-copy.png -------------------------------------------------------------------------------- /NotePad/images/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/printer.png -------------------------------------------------------------------------------- /NotePad/images/question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/question.png -------------------------------------------------------------------------------- /NotePad/images/scissors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/scissors.png -------------------------------------------------------------------------------- /NotePad/images/selection-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/selection-input.png -------------------------------------------------------------------------------- /NotePad/images/ui-tab--plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/NotePad/images/ui-tab--plus.png -------------------------------------------------------------------------------- /NotePad/notepad.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtGui import * 2 | from PyQt5.QtWidgets import * 3 | from PyQt5.QtCore import * 4 | from PyQt5.QtPrintSupport import * 5 | 6 | import os 7 | import sys 8 | 9 | 10 | class MainWindow(QMainWindow): 11 | 12 | def __init__(self, *args, **kwargs): 13 | super(MainWindow, self).__init__(*args, **kwargs) 14 | 15 | layout = QVBoxLayout() 16 | self.editor = QPlainTextEdit() # Could also use a QTextEdit and set self.editor.setAcceptRichText(False) 17 | 18 | 19 | # Setup the QTextEdit editor configuration 20 | fixedfont = QFontDatabase.systemFont(QFontDatabase.FixedFont) 21 | fixedfont.setPointSize(12) 22 | self.editor.setFont(fixedfont) 23 | 24 | # self.path holds the path of the currently open file. 25 | # If none, we haven't got a file open yet (or creating new). 26 | self.path = None 27 | 28 | layout.addWidget(self.editor) 29 | 30 | container = QWidget() 31 | container.setLayout(layout) 32 | self.setCentralWidget(container) 33 | 34 | self.status = QStatusBar() 35 | self.setStatusBar(self.status) 36 | 37 | file_toolbar = QToolBar("File") 38 | file_toolbar.setIconSize(QSize(14, 14)) 39 | self.addToolBar(file_toolbar) 40 | file_menu = self.menuBar().addMenu("&File") 41 | 42 | open_file_action = QAction(QIcon(os.path.join('images', 'blue-folder-open-document.png')), "Open file...", self) 43 | open_file_action.setStatusTip("Open file") 44 | open_file_action.triggered.connect(self.file_open) 45 | file_menu.addAction(open_file_action) 46 | file_toolbar.addAction(open_file_action) 47 | 48 | save_file_action = QAction(QIcon(os.path.join('images', 'disk.png')), "Save", self) 49 | save_file_action.setStatusTip("Save current page") 50 | save_file_action.triggered.connect(self.file_save) 51 | file_menu.addAction(save_file_action) 52 | file_toolbar.addAction(save_file_action) 53 | 54 | saveas_file_action = QAction(QIcon(os.path.join('images', 'disk--pencil.png')), "Save As...", self) 55 | saveas_file_action.setStatusTip("Save current page to specified file") 56 | saveas_file_action.triggered.connect(self.file_saveas) 57 | file_menu.addAction(saveas_file_action) 58 | file_toolbar.addAction(saveas_file_action) 59 | 60 | print_action = QAction(QIcon(os.path.join('images', 'printer.png')), "Print...", self) 61 | print_action.setStatusTip("Print current page") 62 | print_action.triggered.connect(self.file_print) 63 | file_menu.addAction(print_action) 64 | file_toolbar.addAction(print_action) 65 | 66 | edit_toolbar = QToolBar("Edit") 67 | edit_toolbar.setIconSize(QSize(16, 16)) 68 | self.addToolBar(edit_toolbar) 69 | edit_menu = self.menuBar().addMenu("&Edit") 70 | 71 | undo_action = QAction(QIcon(os.path.join('images', 'arrow-curve-180-left.png')), "Undo", self) 72 | undo_action.setStatusTip("Undo last change") 73 | undo_action.triggered.connect(self.editor.undo) 74 | edit_menu.addAction(undo_action) 75 | 76 | redo_action = QAction(QIcon(os.path.join('images', 'arrow-curve.png')), "Redo", self) 77 | redo_action.setStatusTip("Redo last change") 78 | redo_action.triggered.connect(self.editor.redo) 79 | edit_toolbar.addAction(redo_action) 80 | edit_menu.addAction(redo_action) 81 | 82 | edit_menu.addSeparator() 83 | 84 | cut_action = QAction(QIcon(os.path.join('images', 'scissors.png')), "Cut", self) 85 | cut_action.setStatusTip("Cut selected text") 86 | cut_action.triggered.connect(self.editor.cut) 87 | edit_toolbar.addAction(cut_action) 88 | edit_menu.addAction(cut_action) 89 | 90 | copy_action = QAction(QIcon(os.path.join('images', 'document-copy.png')), "Copy", self) 91 | copy_action.setStatusTip("Copy selected text") 92 | copy_action.triggered.connect(self.editor.copy) 93 | edit_toolbar.addAction(copy_action) 94 | edit_menu.addAction(copy_action) 95 | 96 | paste_action = QAction(QIcon(os.path.join('images', 'clipboard-paste-document-text.png')), "Paste", self) 97 | paste_action.setStatusTip("Paste from clipboard") 98 | paste_action.triggered.connect(self.editor.paste) 99 | edit_toolbar.addAction(paste_action) 100 | edit_menu.addAction(paste_action) 101 | 102 | select_action = QAction(QIcon(os.path.join('images', 'selection-input.png')), "Select all", self) 103 | select_action.setStatusTip("Select all text") 104 | select_action.triggered.connect(self.editor.selectAll) 105 | edit_menu.addAction(select_action) 106 | 107 | edit_menu.addSeparator() 108 | 109 | wrap_action = QAction(QIcon(os.path.join('images', 'arrow-continue.png')), "Wrap text to window", self) 110 | wrap_action.setStatusTip("Toggle wrap text to window") 111 | wrap_action.setCheckable(True) 112 | wrap_action.setChecked(True) 113 | wrap_action.triggered.connect(self.edit_toggle_wrap) 114 | edit_menu.addAction(wrap_action) 115 | 116 | self.update_title() 117 | self.show() 118 | 119 | def dialog_critical(self, s): 120 | dlg = QMessageBox(self) 121 | dlg.setText(s) 122 | dlg.setIcon(QMessageBox.Critical) 123 | dlg.show() 124 | 125 | def file_open(self): 126 | path, _ = QFileDialog.getOpenFileName(self, "Open file", "", "Text documents (*.txt);All files (*.*)") 127 | 128 | try: 129 | with open(path, 'rU') as f: 130 | text = f.read() 131 | 132 | except Exception as e: 133 | self.dialog_critical(str(e)) 134 | 135 | else: 136 | self.path = path 137 | self.editor.setPlainText(text) 138 | self.update_title() 139 | 140 | def file_save(self): 141 | if self.path is None: 142 | # If we do not have a path, we need to use Save As. 143 | return self.file_saveas() 144 | 145 | text = self.editor.toPlainText() 146 | try: 147 | with open(self.path, 'w') as f: 148 | f.write(text) 149 | 150 | except Exception as e: 151 | self.dialog_critical(str(e)) 152 | 153 | def file_saveas(self): 154 | path, _ = QFileDialog.getSaveFileName(self, "Save file", "", "Text documents (*.txt);All files (*.*)") 155 | text = self.editor.toPlainText() 156 | 157 | if not path: 158 | # If dialog is cancelled, will return '' 159 | return 160 | 161 | try: 162 | with open(path, 'w') as f: 163 | f.write(text) 164 | 165 | except Exception as e: 166 | self.dialog_critical(str(e)) 167 | 168 | else: 169 | self.path = path 170 | self.update_title() 171 | 172 | def file_print(self): 173 | dlg = QPrintDialog() 174 | if dlg.exec_(): 175 | self.editor.print_(dlg.printer()) 176 | 177 | def update_title(self): 178 | self.setWindowTitle("%s - No2Pads" % (os.path.basename(self.path) if self.path else "Untitled")) 179 | 180 | def edit_toggle_wrap(self): 181 | self.editor.setLineWrapMode( 1 if self.editor.lineWrapMode() == 0 else 0 ) 182 | 183 | 184 | if __name__ == '__main__': 185 | 186 | app = QApplication(sys.argv) 187 | app.setApplicationName("No2Pads") 188 | 189 | window = MainWindow() 190 | app.exec_() -------------------------------------------------------------------------------- /PyTunes/PyTunes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | from PyQt5.QtGui import QPalette, QColor 6 | from PyQt5.QtCore import QUrl, QDirIterator, Qt 7 | from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QFileDialog, QAction, QHBoxLayout, QVBoxLayout, QSlider 8 | from PyQt5.QtMultimedia import QMediaPlaylist, QMediaPlayer, QMediaContent 9 | 10 | 11 | class App(QMainWindow): 12 | 13 | def __init__(self): 14 | super().__init__() 15 | self.player = QMediaPlayer() 16 | self.playlist = QMediaPlaylist() 17 | self.title = 'PyTunes' 18 | self.left = 300 19 | self.top = 300 20 | self.width = 300 21 | self.height = 150 22 | self.color = 0 # 0- toggle to dark 1- toggle to light 23 | self.userAction = -1 # 0- stopped, 1- playing 2-paused 24 | self.initUI() 25 | 26 | def initUI(self): 27 | # Add file menu 28 | menubar = self.menuBar() 29 | filemenu = menubar.addMenu('File') 30 | windowmenu = menubar.addMenu('Window') 31 | 32 | fileAct = QAction('Open File', self) 33 | folderAct = QAction('Open Folder', self) 34 | themeAct = QAction('Toggle light/dark theme', self) 35 | 36 | fileAct.setShortcut('Ctrl+O') 37 | folderAct.setShortcut('Ctrl+D') 38 | themeAct.setShortcut('Ctrl+T') 39 | 40 | filemenu.addAction(fileAct) 41 | filemenu.addAction(folderAct) 42 | windowmenu.addAction(themeAct) 43 | 44 | fileAct.triggered.connect(self.openFile) 45 | folderAct.triggered.connect(self.addFiles) 46 | themeAct.triggered.connect(self.toggleColors) 47 | 48 | self.addControls() 49 | 50 | self.setWindowTitle(self.title) 51 | self.setGeometry(self.left, self.top, self.width, self.height) 52 | self.toggleColors() 53 | self.show() 54 | 55 | def addControls(self): 56 | wid = QWidget(self) 57 | self.setCentralWidget(wid) 58 | # Add song controls 59 | volumeslider = QSlider(Qt.Horizontal, self) 60 | volumeslider.setFocusPolicy(Qt.NoFocus) 61 | volumeslider.valueChanged[int].connect(self.changeVolume) 62 | volumeslider.setValue(100) 63 | playBtn = QPushButton('Play') # play button 64 | pauseBtn = QPushButton('Pause') # pause button 65 | stopBtn = QPushButton('Stop') # stop button 66 | # Add playlist controls 67 | prevBtn = QPushButton('Prev') 68 | shuffleBtn = QPushButton('Shuffle') 69 | nextBtn = QPushButton('Next') 70 | # Add button layouts 71 | controlArea = QVBoxLayout() # centralWidget 72 | controls = QHBoxLayout() 73 | playlistCtrlLayout = QHBoxLayout() 74 | # Add buttons to song controls layout 75 | controls.addWidget(playBtn) 76 | controls.addWidget(pauseBtn) 77 | controls.addWidget(stopBtn) 78 | # Add buttons to playlist controls layout 79 | playlistCtrlLayout.addWidget(prevBtn) 80 | playlistCtrlLayout.addWidget(shuffleBtn) 81 | playlistCtrlLayout.addWidget(nextBtn) 82 | # Add to vertical layout 83 | controlArea.addWidget(volumeslider) 84 | controlArea.addLayout(controls) 85 | controlArea.addLayout(playlistCtrlLayout) 86 | wid.setLayout(controlArea) 87 | # Connect each signal to their appropriate function 88 | playBtn.clicked.connect(self.playhandler) 89 | pauseBtn.clicked.connect(self.pausehandler) 90 | stopBtn.clicked.connect(self.stophandler) 91 | 92 | prevBtn.clicked.connect(self.prevSong) 93 | shuffleBtn.clicked.connect(self.shufflelist) 94 | nextBtn.clicked.connect(self.nextSong) 95 | 96 | self.statusBar() 97 | self.playlist.currentMediaChanged.connect(self.songChanged) 98 | 99 | def openFile(self): 100 | song = QFileDialog.getOpenFileName(self, "Open Song", "~", "Sound Files (*.mp3 *.ogg *.wav *.m4a)") 101 | 102 | if song[0] != '': 103 | url = QUrl.fromLocalFile(song[0]) 104 | if self.playlist.mediaCount() == 0: 105 | self.playlist.addMedia(QMediaContent(url)) 106 | self.player.setPlaylist(self.playlist) 107 | self.player.play() 108 | self.userAction = 1 109 | else: 110 | self.playlist.addMedia(QMediaContent(url)) 111 | 112 | def addFiles(self): 113 | if self.playlist.mediaCount() != 0: 114 | self.folderIterator() 115 | else: 116 | self.folderIterator() 117 | self.player.setPlaylist(self.playlist) 118 | self.player.playlist().setCurrentIndex(0) 119 | self.player.play() 120 | self.userAction = 1 121 | 122 | def folderIterator(self): 123 | folderChosen = QFileDialog.getExistingDirectory(self, 'Open Music Folder', '~') 124 | if folderChosen != None: 125 | it = QDirIterator(folderChosen) 126 | it.next() 127 | while it.hasNext(): 128 | if it.fileInfo().isDir() == False and it.filePath() != '.': 129 | fInfo = it.fileInfo() 130 | if fInfo.suffix() in ('mp3', 'ogg', 'wav', 'm4a'): 131 | self.playlist.addMedia(QMediaContent(QUrl.fromLocalFile(it.filePath()))) 132 | it.next() 133 | if it.fileInfo().isDir() == False and it.filePath() != '.': 134 | fInfo = it.fileInfo() 135 | if fInfo.suffix() in ('mp3', 'ogg', 'wav', 'm4a'): 136 | self.playlist.addMedia(QMediaContent(QUrl.fromLocalFile(it.filePath()))) 137 | 138 | def playhandler(self): 139 | if self.playlist.mediaCount() == 0: 140 | self.openFile() 141 | elif self.playlist.mediaCount() != 0: 142 | self.player.play() 143 | self.userAction = 1 144 | 145 | def pausehandler(self): 146 | self.userAction = 2 147 | self.player.pause() 148 | 149 | def stophandler(self): 150 | self.userAction = 0 151 | self.player.stop() 152 | self.playlist.clear() 153 | self.statusBar().showMessage("Stopped and cleared playlist") 154 | 155 | def changeVolume(self, value): 156 | self.player.setVolume(value) 157 | 158 | def prevSong(self): 159 | if self.playlist.mediaCount() == 0: 160 | self.openFile() 161 | elif self.playlist.mediaCount() != 0: 162 | self.player.playlist().previous() 163 | 164 | def shufflelist(self): 165 | self.playlist.shuffle() 166 | 167 | def nextSong(self): 168 | if self.playlist.mediaCount() == 0: 169 | self.openFile() 170 | elif self.playlist.mediaCount() != 0: 171 | self.player.playlist().next() 172 | 173 | def songChanged(self, media): 174 | if not media.isNull(): 175 | url = media.canonicalUrl() 176 | self.statusBar().showMessage(url.fileName()) 177 | 178 | def toggleColors(self): 179 | 180 | app.setStyle("Fusion") 181 | palette = QPalette() 182 | if self.color == 0: 183 | palette.setColor(QPalette.Window, QColor(53, 53, 53)) 184 | palette.setColor(QPalette.WindowText, Qt.white) 185 | palette.setColor(QPalette.Base, QColor(25, 25, 25)) 186 | palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) 187 | palette.setColor(QPalette.ToolTipBase, Qt.white) 188 | palette.setColor(QPalette.ToolTipText, Qt.white) 189 | palette.setColor(QPalette.Text, Qt.white) 190 | palette.setColor(QPalette.Button, QColor(53, 53, 53)) 191 | palette.setColor(QPalette.ButtonText, Qt.white) 192 | palette.setColor(QPalette.BrightText, Qt.red) 193 | palette.setColor(QPalette.Link, QColor(235, 101, 54)) 194 | palette.setColor(QPalette.Highlight, QColor(235, 101, 54)) 195 | palette.setColor(QPalette.HighlightedText, Qt.black) 196 | app.setPalette(palette) 197 | self.color = 1 198 | elif self.color == 1: 199 | palette.setColor(QPalette.Window, Qt.white) 200 | palette.setColor(QPalette.WindowText, Qt.black) 201 | palette.setColor(QPalette.Base, QColor(240, 240, 240)) 202 | palette.setColor(QPalette.AlternateBase, Qt.white) 203 | palette.setColor(QPalette.ToolTipBase, Qt.white) 204 | palette.setColor(QPalette.ToolTipText, Qt.white) 205 | palette.setColor(QPalette.Text, Qt.black) 206 | palette.setColor(QPalette.Button, Qt.white) 207 | palette.setColor(QPalette.ButtonText, Qt.black) 208 | palette.setColor(QPalette.BrightText, Qt.red) 209 | palette.setColor(QPalette.Link, QColor(66, 155, 248)) 210 | palette.setColor(QPalette.Highlight, QColor(66, 155, 248)) 211 | palette.setColor(QPalette.HighlightedText, Qt.black) 212 | app.setPalette(palette) 213 | self.color = 0 214 | 215 | 216 | if __name__ == '__main__': 217 | app = QApplication(sys.argv) 218 | ex = App() 219 | sys.exit(app.exec_()) 220 | -------------------------------------------------------------------------------- /PyTunes/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/PyTunes/icon.icns -------------------------------------------------------------------------------- /PyTunes/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/PyTunes/icon.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mini-Tools 2 | 一些Python小工具的设计与实现 3 | 4 | ### Image-Edit 5 | 6 | ##### 几个基本的图片编辑工具,包括一下功能: 7 | 8 | + 文件:打开,保存,退出 9 | + 编辑:放大,缩小,灰度,亮度,旋转,截图 10 | + 变换:傅里叶变换,离散余弦变换,Radon变换 11 | + 噪声:高斯,椒盐,斑点,泊松 12 | + 滤波:高通,低通,平滑,锐化 13 | + 直方图统计:R直方图,G直方图,B直方图 14 | + 图像增强:伪彩色,真彩色,直方图均衡,NTSC颜色模型,YCbCr颜色模型,HSV颜色模型 15 | + 阈值分割 16 | + 生态学处理 17 | + 特征提取 18 | + 图像分类与识别 19 | 20 | ![Image-Edit](show_ImageEdit.jpg) 21 | 22 | ##### 库文件需要 23 | ``` 24 | 1. PyQt5 25 | 2. sys 26 | 3. os 27 | 4. opencv2 28 | 5. numpy 29 | 6. scipy 30 | 7. matplotlib 31 | ``` 32 | 33 | ### Beautify-Camera 34 | 35 | ##### 主要功能 36 | 37 | + 文件:打开,保存,打开摄像头 38 | + 操作:还原,人脸识别 39 | + 滤镜:怀旧,木刻,灰色,彩色,风格化,增强细节 40 | + 调节:亮度,饱和度,伽马变换,边缘保持 41 | + 磨皮美白:美白度,磨皮程度,磨皮精度 42 | + 灰度直方图 43 | 44 | ![Beautify-Camera](show_BeautifyCamera.jpg) 45 | 46 | ##### 库文件需要 47 | ``` 48 | 1. PyQt5 49 | 2. sys 50 | 3. opencv2 51 | 4. numpy 52 | 5. matplotlib 53 | ``` 54 | 55 | ##### 相关代码说明 56 | + 人脸识别 57 | ``` 58 | # 人脸识别 59 | def detect_face(self): 60 | img = self.raw_image 61 | face_cascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml') 62 | 63 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 64 | faces = face_cascade.detectMultiScale(gray, 1.3, 5) 65 | return faces 66 | ``` 67 | + 皮肤识别 68 | ``` 69 | # 皮肤识别 70 | def detect_skin(self): 71 | img = self.raw_image 72 | rows, cols, channals = img.shape 73 | for r in range(rows): 74 | for c in range(cols): 75 | B = img.item(r, c, 0) 76 | G = img.item(r, c, 1) 77 | R = img.item(r, c, 2) 78 | if (abs(R - G) > 15) and (R > G) and (R > B): 79 | if (R > 95) and (G > 40) and (B > 20) and (max(R, G, B) - min(R, G, B) > 15): 80 | self.imgskin[r, c] = (1, 1, 1) 81 | elif (R > 220) and (G > 210) and (B > 170): 82 | self.imgskin[r, c] = (1, 1, 1) 83 | ``` 84 | + 其他不做详解 85 | 86 | ### Calculator 87 | ##### 主要功能 88 | + 基本的加减乘除和开根号等运算 89 | 90 | ![Calculator](show_Calculator.jpg) 91 | 92 | ##### 库文件需求 93 | ``` 94 | 1.math 95 | 2.tkinter 96 | ``` 97 | 98 | ### pyQt5-Calculator 99 | ##### 主要功能 100 | + 基本的加减乘除和开根号等运算 101 | 102 | 1.calculator.py 103 | 104 | ![pyQt5-Calculator_1](pyQt5-Calculator_1.jpg) 105 | 106 | 2.Calculator_.py 107 | 108 | ![pyQt5-Calculator_2](pyQt5-Calculator_2.jpg) 109 | 110 | ##### 库文件需求 111 | ``` 112 | 1.PyQt5 113 | 2.sys 114 | 3.math 115 | ``` 116 | 117 | ### Painting绘画 118 | ##### 主要功能 119 | + File:新建画板,打开图片,保存图片 120 | + Edit:复制,清空画板 121 | + Image:翻转 122 | + 工具:基本画笔,橡皮擦,图形创建工具等 123 | + 编辑区,色彩调节区,字体调节区等 124 | 125 | ##### 库文件需求 126 | ``` 127 | 1.PyQt5 128 | 2.random 129 | 3.type 130 | 4.os 131 | ``` 132 | ![show_Painting](show_Painting.jpg) 133 | 134 | ### NotePad 135 | ##### 主要功能 136 | + 基本文本编辑,类似于记事本 137 | 138 | ##### 库文件需求 139 | ``` 140 | 1.pyQt5 141 | 2.sys 142 | 3.os 143 | ``` 144 | ![(show_NotePad](show_NotePad.jpg) 145 | 146 | ### RandomPassWord 147 | ##### 主要功能 148 | + 随机生成一串密码,包括大小写字母,数字,符号,可指定长度 149 | 150 | ![show_RandomPassword](show_RandomPassword.jpg) 151 | 152 | ##### 库文件引入 153 | ``` 154 | 1.secrets 155 | 2.pyQt5 156 | 3.sys 157 | ``` 158 | 159 | ### Browser 160 | ##### 主要功能 161 | + 基本浏览器功能 162 | 163 | ![show_Browser](show_Browser.jpg) 164 | ##### 库函数需求 165 | ``` 166 | 1.pyQt5 167 | 2.os 168 | 3.sys 169 | ``` 170 | 171 | ### MusicPlayer 172 | ##### 主要功能 173 | + 音乐播放器 174 | 175 | ![show_MusicPlayer](show_MusicPlayer.jpg) 176 | 177 | ##### 库函数引用 178 | ``` 179 | 1.os 180 | 2.sys 181 | 3.time 182 | 4.pyQt5 183 | ``` 184 | 185 | ### PyTunes 186 | ##### 主要功能 187 | + 轻量级音乐播放器 188 | 189 | ![show_PyTunes](show_PyTunes.jpg) 190 | 191 | ##### 库函数引用 192 | ``` 193 | 1.sys 194 | 2.pyQt5 195 | ``` 196 | -------------------------------------------------------------------------------- /RandomPassWord/RandomPasswordGenerator.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import secrets 3 | 4 | from PyQt5.QtWidgets import QWidget,QHBoxLayout,QApplication,QCheckBox,QLabel,QPushButton,QVBoxLayout,QLineEdit 5 | 6 | class Window(QWidget): 7 | 8 | def __init__(self): 9 | 10 | super().__init__() 11 | 12 | self.initUI() 13 | 14 | def initUI(self): 15 | 16 | #checkbox,input,button,label 17 | self.checkbox0 = QCheckBox("Lowercase Letter") 18 | self.checkbox1 = QCheckBox("Uppercase Letter") 19 | self.checkbox2 = QCheckBox("Number") 20 | self.checkbox3 = QCheckBox("Symbols") 21 | self.length = QLineEdit("Length") 22 | self.button = QPushButton("New Password") 23 | self.password = QLineEdit("") 24 | 25 | v_box = QVBoxLayout() #Vertical Layout 26 | v_box.addWidget(self.checkbox0) 27 | v_box.addWidget(self.checkbox1) 28 | v_box.addWidget(self.checkbox2) 29 | v_box.addWidget(self.checkbox3) 30 | v_box.addWidget(self.length) 31 | v_box.addWidget(self.button) 32 | v_box.addWidget(self.password) 33 | 34 | h_box = QHBoxLayout() #Horizontal Layout 35 | h_box.addLayout(v_box) 36 | 37 | self.setLayout(h_box) 38 | 39 | self.setWindowTitle("Random Password Generator") 40 | 41 | self.button.clicked.connect(lambda : self.generate(self.checkbox0.isChecked(),self.checkbox1.isChecked(),self.checkbox2.isChecked(),self.checkbox3.isChecked(),self.length)) 42 | 43 | self.show() 44 | 45 | def generate(self,checkbox0,checkbox1,checkbox2,checkbox3,length): 46 | 47 | lowercase_letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","r","s","t","u","v","w","x","y","z"] 48 | 49 | uppercase_letters = [i.upper() for i in lowercase_letters] 50 | 51 | numbers = [0,1,2,3,4,5,6,7,8,9] 52 | 53 | symbols = ["!","'","^","+","%","&","/","(",")","=","?","_","-","*",">","#","{","[","]","}","<"] 54 | 55 | elements = [] 56 | 57 | password = "" 58 | if checkbox0: 59 | elements.append(lowercase_letters) 60 | if checkbox1: 61 | elements.append(uppercase_letters) 62 | if checkbox2: 63 | elements.append(numbers) 64 | if checkbox3: 65 | elements.append(symbols) 66 | digitCounter = 0; 67 | try: 68 | while(digitCounter < int(self.length.text())): 69 | randomChoice = str(secrets.choice(secrets.choice(elements))) 70 | if randomChoice not in password: 71 | password+=randomChoice 72 | digitCounter+=1 73 | self.password.setText(password) 74 | except ValueError: 75 | self.password.setText("Please enter a length.") 76 | except IndexError: 77 | self.password.setText("Please select an option. ") 78 | except: 79 | self.password.setText("Error") 80 | 81 | app = QApplication(sys.argv) 82 | 83 | window = Window() 84 | 85 | sys.exit(app.exec_()) 86 | -------------------------------------------------------------------------------- /RandomPassWord/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pyQt5-Calculator_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/pyQt5-Calculator_1.jpg -------------------------------------------------------------------------------- /pyQt5-Calculator_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/pyQt5-Calculator_2.jpg -------------------------------------------------------------------------------- /pyQt5-计算器/Calculator_.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from PyQt5.QtWidgets import * 3 | # QMainWindow, QPushButton, QApplication, QAction 4 | from PyQt5 import QtCore, QtGui 5 | from PyQt5.QtCore import pyqtSlot, Qt 6 | 7 | class Window(QMainWindow): 8 | 9 | enlargeCount = 0 10 | enlargeButtonsCount = 0 11 | licznik = 0 12 | liczba = 0 13 | numbers = [] 14 | flagNew = 0 15 | numberorsign = 0 #1 number, 2 sign 16 | numbers.append(0) 17 | textL = "" 18 | 19 | 20 | # if flag == 1 then addition 21 | # if flag == 2 then substract 22 | # if flag == 3 then multiplication 23 | # if flag == 4 then division 24 | flag = 0 25 | def __init__(self): 26 | super(Window,self).__init__() 27 | self.setGeometry(150,150,500,500) 28 | self.okno = QWidget(self) 29 | self.setCentralWidget(self.okno) 30 | self.mainLayout = QVBoxLayout() 31 | # self.mainLayout.setGeometry(100,100,300,300) 32 | self.gridLayout = QGridLayout() 33 | self.okno.setLayout(self.mainLayout) 34 | self.setWindowTitle("Kalkulator") 35 | # menu 36 | #extractAction = QtGui.QActionEvent('&Menu',self) 37 | 38 | self.home() 39 | self.mainLayout.addLayout(self.gridLayout) 40 | checkbox = QCheckBox('Zwieksz okno',self) 41 | checkbox.move(10,30) 42 | checkbox.stateChanged.connect(self.enlarge) 43 | self.mainLayout.addWidget(checkbox, alignment=Qt.AlignCenter) 44 | # print(self.style().objectName()) 45 | self.StyleChoice = QLabel("Windows Vista",self) 46 | combobox = QComboBox(self) 47 | combobox.addItem("windowsvista") 48 | combobox.addItem("windowsxp") 49 | combobox.addItem("Windows") 50 | combobox.addItem("Fusion") 51 | 52 | self.mainLayout.addWidget(self.StyleChoice, alignment = Qt.AlignLeft) 53 | self.mainLayout.addWidget(combobox, alignment = Qt.AlignLeft) 54 | combobox.activated[str].connect(self.stylechoice) 55 | 56 | 57 | self.color = QLabel("Choose color:",self) 58 | self.mainLayout.addWidget(self.color, alignment=Qt.AlignRight) 59 | comboboxcolor = QComboBox(self) 60 | comboboxcolor.addItem("grey") 61 | comboboxcolor.addItem("red") 62 | comboboxcolor.addItem("green") 63 | comboboxcolor.addItem("blue") 64 | comboboxcolor.addItem("yellow") 65 | self.mainLayout.addWidget(comboboxcolor, alignment = Qt.AlignRight) 66 | comboboxcolor.activated[str].connect(self.colorchoice) 67 | 68 | self.show() 69 | 70 | self.initUI() 71 | 72 | def colorchoice(self,text): 73 | self.btn0.setStyleSheet("background-color:"+text) 74 | self.btn1.setStyleSheet("background-color:"+text) 75 | self.btn2.setStyleSheet("background-color:"+text) 76 | self.btn3.setStyleSheet("background-color:"+text) 77 | self.btn4.setStyleSheet("background-color:"+text) 78 | self.btn5.setStyleSheet("background-color:"+text) 79 | self.btn6.setStyleSheet("background-color:"+text) 80 | self.btn7.setStyleSheet("background-color:"+text) 81 | self.btn8.setStyleSheet("background-color:"+text) 82 | self.btn9.setStyleSheet("background-color:"+text) 83 | self.btnp.setStyleSheet("background-color:"+text) 84 | self.btnm.setStyleSheet("background-color:"+text) 85 | self.btnmn.setStyleSheet("background-color:"+text) 86 | self.btndz.setStyleSheet("background-color:"+text) 87 | self.btneq.setStyleSheet("background-color:"+text) 88 | self.btnC.setStyleSheet("background-color:"+text) 89 | 90 | def stylechoice(self,text): 91 | self.StyleChoice.setText(text) 92 | QApplication.setStyle(QStyleFactory.create(text)) 93 | 94 | def enlarge(self,state): 95 | if self.enlargeCount == 0: 96 | self.setGeometry(150,150,800,800) 97 | self.enlargeCount = 1 98 | else: 99 | self.setGeometry(150,150,300,300) 100 | self.enlargeCount = 0 101 | 102 | 103 | #menu 104 | def initUI(self): 105 | exitAction = QAction('&Exit', self) 106 | exitAction.setShortcut('Ctrl+Q') 107 | exitAction.setStatusTip('Exit application') 108 | exitAction.triggered.connect(self.close) 109 | 110 | enlargeAction = QAction('&Enlarge', self) 111 | enlargeAction.setShortcut('Ctrl+L') 112 | enlargeAction.setStatusTip('Enlarge window') 113 | enlargeAction.triggered.connect(self.enlarge) 114 | 115 | enlargeButtonsAction = QAction('&EnlargeButtons', self) 116 | enlargeButtonsAction.setShortcut('Ctrl+B') 117 | enlargeButtonsAction.setStatusTip('Enlarge Buttons') 118 | enlargeButtonsAction.triggered.connect(self.enlargeButtons) 119 | 120 | 121 | 122 | # self.statusBar() 123 | 124 | menubar = self.menuBar() 125 | fileMenu = menubar.addMenu('&File') 126 | fileMenu.addAction(enlargeButtonsAction) 127 | fileMenu.addAction(enlargeAction) 128 | fileMenu.addAction(exitAction) 129 | 130 | self.show() 131 | 132 | def enlargeButtons(self): 133 | if self.enlargeButtonsCount == 0: 134 | self.btn0.setFixedSize(80,80) 135 | self.btn1.setFixedSize(80,80) 136 | self.btn2.setFixedSize(80,80) 137 | self.btn3.setFixedSize(80,80) 138 | self.btn4.setFixedSize(80,80) 139 | self.btn5.setFixedSize(80,80) 140 | self.btn6.setFixedSize(80,80) 141 | self.btn7.setFixedSize(80,80) 142 | self.btn8.setFixedSize(80,80) 143 | self.btn9.setFixedSize(80,80) 144 | self.btnp.setFixedSize(80,80) 145 | self.btnm.setFixedSize(80,80) 146 | self.btnmn.setFixedSize(80,80) 147 | self.btndz.setFixedSize(80,80) 148 | self.btneq.setFixedSize(80,80) 149 | self.btnC.setFixedSize(80,80) 150 | self.enlargeButtonsCount = 1 151 | self.setGeometry(150, 150, 600, 600) 152 | else: 153 | self.btn0.setFixedSize(40, 40) 154 | self.btn1.setFixedSize(40, 40) 155 | self.btn2.setFixedSize(40, 40) 156 | self.btn3.setFixedSize(40, 40) 157 | self.btn4.setFixedSize(40, 40) 158 | self.btn5.setFixedSize(40, 40) 159 | self.btn6.setFixedSize(40, 40) 160 | self.btn7.setFixedSize(40, 40) 161 | self.btn8.setFixedSize(40, 40) 162 | self.btn9.setFixedSize(40, 40) 163 | self.btnp.setFixedSize(40, 40) 164 | self.btnm.setFixedSize(40, 40) 165 | self.btnmn.setFixedSize(40, 40) 166 | self.btndz.setFixedSize(40, 40) 167 | self.btneq.setFixedSize(40, 40) 168 | self.btnC.setFixedSize(40, 40) 169 | self.enlargeButtonsCount = 0 170 | self.setGeometry(150, 150, 300, 300) 171 | # self.show() 172 | 173 | 174 | # buttons 175 | def home(self): 176 | 177 | self.resultlabel = QLabel("0",self) 178 | self.resultlabel.setFont(QtGui.QFont('SansSerif', 15)) 179 | self.resultlabel.resize(self.resultlabel.minimumSizeHint()) 180 | # self.resultlabel.setText("wynik") 181 | self.mainLayout.addWidget(self.resultlabel) 182 | 183 | self.btn0 = QPushButton('0',self) 184 | self.btn0.clicked.connect(self.on_click0) 185 | self.btn0.resize(self.btn0.minimumSizeHint()) 186 | # btn0.move(100, 50) 187 | self.gridLayout.addWidget(self.btn0,1,0) 188 | 189 | self.btn1 = QPushButton('1',self) 190 | self.btn1.clicked.connect(self.on_click1) 191 | self.btn1.resize(self.btn1.minimumSizeHint()) 192 | self.gridLayout.addWidget(self.btn1,1,1) 193 | # btn1.move(100,100) 194 | 195 | self.btn2 = QPushButton('2',self) 196 | self.btn2.clicked.connect(self.on_click2) 197 | self.btn2.resize(self.btn2.minimumSizeHint()) 198 | self.gridLayout.addWidget(self.btn2,1,2) 199 | # btn2.move(100,150) 200 | 201 | self.btn3 = QPushButton('3',self) 202 | self.btn3.clicked.connect(self.on_click3) 203 | self.btn3.resize(self.btn3.minimumSizeHint()) 204 | self.gridLayout.addWidget(self.btn3,2,0) 205 | # btn3.move(100,200) 206 | 207 | self.btn4 = QPushButton('4',self) 208 | self.btn4.clicked.connect(self.on_click4) 209 | self.btn4.resize(self.btn4.minimumSizeHint()) 210 | self.gridLayout.addWidget(self.btn4,2,1) 211 | # btn4.move(100, 250) 212 | 213 | self.btn5 = QPushButton('5',self) 214 | self.btn5.clicked.connect(self.on_click5) 215 | self.btn5.resize(self.btn5.minimumSizeHint()) 216 | self.gridLayout.addWidget(self.btn5,2,2) 217 | # btn5.move(100, 300) 218 | 219 | self.btn6 = QPushButton('6',self) 220 | self.btn6.clicked.connect(self.on_click6) 221 | self.btn6.resize(self.btn6.minimumSizeHint()) 222 | self.gridLayout.addWidget(self.btn6,3,0) 223 | # btn6.move(100, 350) 224 | 225 | self.btn7 = QPushButton('7',self) 226 | self.btn7.clicked.connect(self.on_click7) 227 | self.btn7.resize(self.btn7.minimumSizeHint()) 228 | self.gridLayout.addWidget(self.btn7,3,1) 229 | # btn7.move(100, 400) 230 | 231 | self.btn8 = QPushButton('8',self) 232 | self.btn8.clicked.connect(self.on_click8) 233 | self.btn8.resize(self.btn8.minimumSizeHint()) 234 | self.gridLayout.addWidget(self.btn8,3,2) 235 | # btn8.move(100, 450) 236 | 237 | self.btn9 = QPushButton('9',self) 238 | self.btn9.clicked.connect(self.on_click9) 239 | self.btn9.resize(self.btn9.minimumSizeHint()) 240 | self.gridLayout.addWidget(self.btn9,4,0) 241 | # btn9.move(100, 500) 242 | 243 | self.btnp = QPushButton('+',self) 244 | self.btnp.clicked.connect(self.on_clickp) 245 | self.btnp.resize(self.btnp.minimumSizeHint()) 246 | self.gridLayout.addWidget(self.btnp,1,3) 247 | # btnp.move(200, 500) 248 | 249 | self.btnm = QPushButton('-',self) 250 | self.btnm.clicked.connect(self.on_clickm) 251 | self.btnm.resize(self.btnm.minimumSizeHint()) 252 | self.gridLayout.addWidget(self.btnm,2,3) 253 | # btnm.move(200, 450) 254 | 255 | self.btnmn = QPushButton('*',self) 256 | self.btnmn.clicked.connect(self.on_clickmn) 257 | self.btnmn.resize(self.btnmn.minimumSizeHint()) 258 | self.gridLayout.addWidget(self.btnmn,3,3) 259 | # btnmn.move(200, 400) 260 | 261 | self.btndz = QPushButton('/',self) 262 | self.btndz.clicked.connect(self.on_clickdz) 263 | self.btndz.resize(self.btndz.minimumSizeHint()) 264 | self.gridLayout.addWidget(self.btndz,4,3) 265 | # btndz.move(200, 350) 266 | 267 | self.btneq = QPushButton('=',self) 268 | self.btneq.clicked.connect(self.on_clickeq) 269 | self.btneq.resize(self.btneq.minimumSizeHint()) 270 | self.gridLayout.addWidget(self.btneq,4,2) 271 | 272 | self.btnC = QPushButton('C', self) 273 | self.btnC.clicked.connect(self.on_clickC) 274 | self.btnC.resize(self.btnC.minimumSizeHint()) 275 | self.gridLayout.addWidget(self.btnC, 4, 1) 276 | 277 | # btneq.move(200, 300) 278 | self.btn0.setFixedSize(40, 40) 279 | self.btn1.setFixedSize(40, 40) 280 | self.btn2.setFixedSize(40, 40) 281 | self.btn3.setFixedSize(40, 40) 282 | self.btn4.setFixedSize(40, 40) 283 | self.btn5.setFixedSize(40, 40) 284 | self.btn6.setFixedSize(40, 40) 285 | self.btn7.setFixedSize(40, 40) 286 | self.btn8.setFixedSize(40, 40) 287 | self.btn9.setFixedSize(40, 40) 288 | self.btnp.setFixedSize(40, 40) 289 | self.btnm.setFixedSize(40, 40) 290 | self.btnmn.setFixedSize(40, 40) 291 | self.btndz.setFixedSize(40, 40) 292 | self.btneq.setFixedSize(40, 40) 293 | self.btnC.setFixedSize(40, 40) 294 | 295 | 296 | 297 | def on_click0(self): 298 | self.liczba = self.liczba*10 + 0 299 | print(self.liczba) 300 | 301 | self.textL = self.textL+"0" 302 | if self.licznik == 0: 303 | self.textL = (str)(self.liczba) 304 | self.resultlabel.setText(self.textL) 305 | self.numberorsign = 1 306 | # self.licznik = self.licznik + 1 307 | 308 | def on_click1(self): 309 | self.liczba = self.liczba * 10 + 1 310 | print(self.liczba) 311 | self.textL = self.textL+"1" 312 | if self.licznik == 0: 313 | self.textL = (str)(self.liczba) 314 | self.resultlabel.setText(self.textL) 315 | self.numberorsign = 1 316 | # self.licznik = self.licznik + 1 317 | 318 | def on_click2(self): 319 | self.liczba = self.liczba * 10 + 2 320 | print(self.liczba) 321 | self.textL = self.textL+"2" 322 | if self.licznik == 0: 323 | self.textL = (str)(self.liczba) 324 | self.resultlabel.setText(self.textL) 325 | self.numberorsign = 1 326 | 327 | def on_click3(self): 328 | 329 | self.liczba = self.liczba * 10 + 3 330 | print(self.liczba) 331 | self.textL = self.textL+"3" 332 | if self.licznik == 0: 333 | self.textL = (str)(self.liczba) 334 | self.resultlabel.setText(self.textL) 335 | self.numberorsign = 1 336 | # self.licznik = self.licznik + 1 337 | 338 | def on_click4(self): 339 | self.liczba = self.liczba * 10 + 4 340 | print(self.liczba) 341 | self.textL = self.textL+"4" 342 | if self.licznik == 0: 343 | self.textL = (str)(self.liczba) 344 | self.resultlabel.setText(self.textL) 345 | # self.licznik = self.licznik + 1 346 | 347 | def on_click5(self): 348 | self.liczba = self.liczba * 10 + 5 349 | print(self.liczba) 350 | self.textL = self.textL+"5" 351 | if self.licznik == 0: 352 | self.textL = (str)(self.liczba) 353 | self.resultlabel.setText(self.textL) 354 | self.numberorsign = 1 355 | # self.licznik = self.licznik + 1 356 | 357 | def on_click6(self): 358 | self.liczba = self.liczba * 10 + 6 359 | print(self.liczba) 360 | self.textL = self.textL+"6" 361 | if self.licznik == 0: 362 | self.textL = (str)(self.liczba) 363 | self.resultlabel.setText(self.textL) 364 | self.numberorsign = 1 365 | # self.licznik = self.licznik + 1 366 | 367 | def on_click7(self): 368 | self.liczba = self.liczba * 10 + 7 369 | print(self.liczba) 370 | self.textL = self.textL+"7" 371 | if self.licznik == 0: 372 | self.textL = (str)(self.liczba) 373 | self.resultlabel.setText(self.textL) 374 | self.numberorsign = 1 375 | # self.licznik = self.licznik + 1 376 | 377 | def on_click8(self): 378 | self.liczba = self.liczba * 10 + 8 379 | print(self.liczba) 380 | self.textL = self.textL+"8" 381 | if self.licznik == 0: 382 | self.textL = (str)(self.liczba) 383 | self.resultlabel.setText(self.textL) 384 | self.numberorsign = 1 385 | # self.licznik = self.licznik + 1 386 | 387 | def on_click9(self): 388 | self.liczba = self.liczba * 10 + 9 389 | print(self.liczba) 390 | self.textL = self.textL+"9" 391 | if self.licznik == 0: 392 | self.textL = (str)(self.liczba) 393 | self.resultlabel.setText(self.textL) 394 | self.numberorsign = 1 395 | # self.licznik = self.licznik + 1 396 | 397 | def on_clickm(self): 398 | self.flagNew = self.flag 399 | self.flag = 2 400 | result = 0 401 | # first = self.numbers[-2] 402 | if self.liczba!=0: 403 | if self.licznik == 0: 404 | self.numbers.append(self.liczba) 405 | if self.numberorsign == 1: 406 | if self.flagNew == 1: 407 | result = self.numbers[-1] + self.liczba 408 | self.numbers.append(result) 409 | if self.flagNew == 2: 410 | result = self.numbers[-1] - self.liczba 411 | # print(self.numbers[-1],' - ',self.liczba,' = ',result) 412 | self.numbers.append(result) 413 | if self.flagNew == 3: 414 | result = self.numbers[-1] * self.liczba 415 | self.numbers.append(result) 416 | if self.flagNew == 4: 417 | if self.liczba!=0: 418 | result = self.numbers[-1] / self.liczba 419 | self.numbers.append(result) 420 | else: 421 | self.resultlabel.setText("Nie dziel przez zero") 422 | self.liczba = 0 423 | return 424 | 425 | self.numberorsign = 2 426 | 427 | # self.numbers.append(self.liczba) 428 | self.liczba = 0 429 | 430 | 431 | print('wynik',self.numbers[-1]) 432 | self.textL = self.textL+"-" 433 | self.resultlabel.setText(self.textL) 434 | # print(self.liczba) 435 | self.licznik = self.licznik + 1 436 | 437 | def on_clickp(self): 438 | self.flagNew = self.flag 439 | self.flag = 1 440 | result = 0 441 | # first = self.numbers[-2] 442 | if self.liczba!=0: 443 | if self.licznik == 0: 444 | self.numbers.append(self.liczba) 445 | 446 | if self.numberorsign == 1: 447 | if self.flagNew == 1: 448 | result = self.numbers[-1] + self.liczba 449 | self.numbers.append(result) 450 | if self.flagNew == 2: 451 | result = self.numbers[-1] - self.liczba 452 | print(self.numbers[-1], ' - ', self.liczba, ' = ', result) 453 | self.numbers.append(result) 454 | if self.flagNew == 3: 455 | result = self.numbers[-1] * self.liczba 456 | self.numbers.append(result) 457 | if self.flagNew == 4: 458 | if self.liczba!=0: 459 | result = self.numbers[-1] / self.liczba 460 | self.numbers.append(result) 461 | else: 462 | self.resultlabel.setText("Nie dziel przez zero") 463 | self.liczba = 0 464 | return 465 | 466 | self.numberorsign = 2 467 | # self.numbers.append(self.liczba) 468 | self.liczba = 0 469 | 470 | print('wynik', self.numbers[-1]) 471 | self.textL = self.textL+"+" 472 | self.resultlabel.setText(self.textL) 473 | # print(self.liczba) 474 | self.licznik = self.licznik + 1 475 | 476 | def on_clickmn(self): 477 | self.flagNew = self.flag 478 | self.flag = 3 479 | result = 0 480 | # first = self.numbers[-2] 481 | if self.liczba!=0: 482 | 483 | if self.licznik == 0: 484 | self.numbers.append(self.liczba) 485 | 486 | if self.numberorsign == 1: 487 | if self.flagNew == 1: 488 | result = self.numbers[-1] + self.liczba 489 | self.numbers.append(result) 490 | if self.flagNew == 2: 491 | result = self.numbers[-1] - self.liczba 492 | # print(self.numbers[-1], ' - ', self.liczba, ' = ', result) 493 | self.numbers.append(result) 494 | if self.flagNew == 3: 495 | result = self.numbers[-1] * self.liczba 496 | self.numbers.append(result) 497 | if self.flagNew == 4: 498 | if self.liczba!=0: 499 | result = self.numbers[-1] / self.liczba 500 | self.numbers.append(result) 501 | else: 502 | self.resultlabel.setText("Nie dziel przez zero") 503 | self.liczba = 0 504 | return 505 | 506 | self.numberorsign = 2 507 | # self.numbers.append(self.liczba) 508 | self.liczba = 0 509 | 510 | print('wynik', self.numbers[-1]) 511 | # print(self.liczba) 512 | self.textL = self.textL+"*" 513 | self.resultlabel.setText(self.textL) 514 | self.licznik = self.licznik + 1 515 | 516 | def on_clickdz(self): 517 | self.flagNew = self.flag 518 | self.flag = 4 519 | result = 0 520 | # first = self.numbers[-2] 521 | if self.liczba!=0: 522 | if self.licznik == 0: 523 | self.numbers.append(self.liczba) 524 | if self.numberorsign == 1: 525 | if self.flagNew == 1: 526 | result = self.numbers[-1] + self.liczba 527 | self.numbers.append(result) 528 | if self.flagNew == 2: 529 | result = self.numbers[-1] - self.liczba 530 | print(self.numbers[-1], ' - ', self.liczba, ' = ', result) 531 | self.numbers.append(result) 532 | if self.flagNew == 3: 533 | result = self.numbers[-1] * self.liczba 534 | self.numbers.append(result) 535 | if self.flagNew == 4: 536 | if self.liczba!=0: 537 | result = self.numbers[-1] / self.liczba 538 | self.numbers.append(result) 539 | else: 540 | self.resultlabel.setText("Nie dziel przez zero") 541 | self.liczba = 0 542 | return 543 | 544 | self.numberorsign = 2 545 | # self.numbers.append(self.liczba) 546 | self.liczba = 0 547 | 548 | print('wynik = ', self.numbers[-1]) 549 | # print(self.liczba) 550 | self.textL = self.textL+"/" 551 | self.resultlabel.setText(self.textL) 552 | self.licznik = self.licznik + 1 553 | 554 | def on_clickeq(self): 555 | self.flagNew = self.flag 556 | self.flag = 0 557 | result = 0 558 | if self.numberorsign == 1: 559 | if self.flagNew == 1: 560 | result = self.numbers[-1] + self.liczba 561 | self.numbers.append(result) 562 | if self.flagNew == 2: 563 | result = self.numbers[-1] - self.liczba 564 | print(self.numbers[-1], ' - ', self.liczba, ' = ', result) 565 | self.numbers.append(result) 566 | if self.flagNew == 3: 567 | result = self.numbers[-1] * self.liczba 568 | self.numbers.append(result) 569 | if self.flagNew == 4: 570 | if self.liczba != 0: 571 | result = self.numbers[-1] / self.liczba 572 | self.numbers.append(result) 573 | else: 574 | self.resultlabel.setText("Nie dziel przez zero") 575 | self.liczba = 0 576 | self.numbers = [] 577 | self.numbers.append(0) 578 | self.licznik = 0 579 | self.textL = "" 580 | return 581 | print('wynik = ', self.numbers[-1]) 582 | self.textL = self.textL+"=" 583 | self.resultlabel.setText(self.textL+(str)(self.numbers[-1])) 584 | self.liczba = 0 585 | self.numbers = [] 586 | self.numbers.append(0) 587 | self.licznik = 0 588 | self.textL = "" 589 | 590 | def on_clickC(self): 591 | self.liczba = 0 592 | self.numbers = [] 593 | self.numbers.append(0) 594 | self.licznik = 0 595 | self.textL = "" 596 | self.textL = self.textL+"0" 597 | self.resultlabel.setText(self.textL) 598 | 599 | 600 | def close(self): 601 | choice = QMessageBox.question(self,'Extract',"Are you sure you want to quit?",QMessageBox.Yes|QMessageBox.No) 602 | 603 | if choice == QMessageBox.Yes: 604 | print("Zamykamy sie") 605 | sys.exit() 606 | else: 607 | pass 608 | 609 | def rozmiar_wiek(self): 610 | self.btn0.resize(100, 100) 611 | self.btn1.resize(100,100) 612 | 613 | def closeEvent(self, QCloseEvent): 614 | QCloseEvent.ignore() 615 | self.close() 616 | 617 | def keyPressEvent(self, event): 618 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_0: 619 | self.on_click0() 620 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_1: 621 | self.on_click1() 622 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_2: 623 | self.on_click2() 624 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_3: 625 | self.on_click3() 626 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_4: 627 | self.on_click4() 628 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_5: 629 | self.on_click5() 630 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_6: 631 | self.on_click6() 632 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_7: 633 | self.on_click7() 634 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_8: 635 | self.on_click8() 636 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_9: 637 | self.on_click9() 638 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_Plus: 639 | self.on_clickp() 640 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_Minus: 641 | self.on_clickm() 642 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_Slash: 643 | self.on_clickdz() 644 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_Asterisk: 645 | self.on_clickmn() 646 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_Equal: 647 | self.on_clickeq() 648 | if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_C: 649 | self.on_clickC() 650 | 651 | def run(): 652 | 653 | app = QApplication(sys.argv) 654 | GUI = Window() 655 | sys.exit(app.exec()) 656 | 657 | run() 658 | -------------------------------------------------------------------------------- /pyQt5-计算器/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /pyQt5-计算器/calculator.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from PyQt5.QtCore import * 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtWidgets import * 5 | from math import sqrt 6 | 7 | NUM = 0.0 8 | NEW_NUMBER = 0.0 9 | SUM_IT = 0.0 10 | RESULT = 0.0 11 | SYMBOL = "" 12 | 13 | OPERATION = False 14 | 15 | 16 | class Calculator(QMainWindow): 17 | def __init__(self): 18 | super().__init__() 19 | self.title = 'This is a cool calculator' 20 | self.left = 300 21 | self.top = 300 22 | self.width = 270 23 | self.height = 480 24 | self.initUI() 25 | 26 | def initUI(self): 27 | self.setWindowTitle(self.title) 28 | self.setGeometry(self.left, self.top, self.width, self.height) 29 | self.setFixedSize(260, 420) 30 | 31 | self.line = QLineEdit(self) 32 | self.line.move(10, 10) 33 | self.line.setReadOnly(True) 34 | self.line.setAlignment(Qt.AlignRight) 35 | font = self.line.font() 36 | font.setPointSize(40) 37 | self.line.setFont(font) 38 | self.line.resize(240, 70) 39 | self.line.setStyleSheet("border: none; background: #323232;") 40 | 41 | # numbers 42 | zero = QPushButton("0", self) 43 | zero.move(5, 350) 44 | zero.resize(130, 70) 45 | zero.clicked.connect(self.show_numbers) 46 | zero.setStyleSheet( 47 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 48 | one = QPushButton("1", self) 49 | one.move(5, 290) 50 | one.resize(70, 70) 51 | one.clicked.connect(self.show_numbers) 52 | one.setStyleSheet( 53 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 54 | 55 | two = QPushButton("2", self) 56 | two.move(65, 290) 57 | two.resize(70, 70) 58 | two.clicked.connect(self.show_numbers) 59 | two.setStyleSheet( 60 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 61 | 62 | three = QPushButton("3", self) 63 | three.move(125, 290) 64 | three.resize(70, 70) 65 | three.clicked.connect(self.show_numbers) 66 | three.setStyleSheet( 67 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 68 | 69 | four = QPushButton("4", self) 70 | four.move(5, 230) 71 | four.resize(70, 70) 72 | four.clicked.connect(self.show_numbers) 73 | four.setStyleSheet( 74 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 75 | 76 | five = QPushButton("5", self) 77 | five.move(65, 230) 78 | five.resize(70, 70) 79 | five.clicked.connect(self.show_numbers) 80 | five.setStyleSheet( 81 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 82 | 83 | six = QPushButton("6", self) 84 | six.move(125, 230) 85 | six.resize(70, 70) 86 | six.clicked.connect(self.show_numbers) 87 | six.setStyleSheet( 88 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 89 | 90 | seven = QPushButton("7", self) 91 | seven.move(5, 170) 92 | seven.resize(70, 70) 93 | seven.clicked.connect(self.show_numbers) 94 | seven.setStyleSheet( 95 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 96 | 97 | eight = QPushButton("8", self) 98 | eight.move(65, 170) 99 | eight.resize(70, 70) 100 | eight.clicked.connect(self.show_numbers) 101 | eight.setStyleSheet( 102 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 103 | 104 | nine = QPushButton("9", self) 105 | nine.move(125, 170) 106 | nine.resize(70, 70) 107 | nine.clicked.connect(self.show_numbers) 108 | nine.setStyleSheet( 109 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 110 | 111 | # SYMBOLS 112 | plus = QPushButton("+", self) 113 | plus.move(185, 290) 114 | plus.resize(70, 70) 115 | plus.clicked.connect(self.symbol) 116 | plus.setStyleSheet( 117 | "QPushButton { background-color: #FF9500; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #BE6A0A; }") 118 | 119 | minus = QPushButton("-", self) 120 | minus.move(185, 230) 121 | minus.resize(70, 70) 122 | minus.clicked.connect(self.symbol) 123 | minus.setStyleSheet( 124 | "QPushButton { background-color: #FF9500; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #BE6A0A; }") 125 | 126 | multiply = QPushButton("x", self) 127 | multiply.move(185, 170) 128 | multiply.resize(70, 70) 129 | multiply.clicked.connect(self.symbol) 130 | multiply.setStyleSheet( 131 | "QPushButton { background-color: #FF9500; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #BE6A0A; }") 132 | 133 | divide = QPushButton("÷", self) 134 | divide.move(185, 110) 135 | divide.resize(70, 70) 136 | divide.clicked.connect(self.symbol) 137 | divide.setStyleSheet( 138 | "QPushButton { background-color: #FF9500; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #BE6A0A; }") 139 | 140 | point = QPushButton(".", self) 141 | point.move(125, 350) 142 | point.resize(70, 70) 143 | point.clicked.connect(self.point) 144 | point.setStyleSheet( 145 | "QPushButton { background-color: #505050; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #D4D4D2; }") 146 | 147 | equals = QPushButton("=", self) 148 | equals.move(185, 350) 149 | equals.resize(70, 70) 150 | equals.clicked.connect(self.symbol) 151 | equals.setStyleSheet( 152 | "QPushButton { background-color: #FF9500; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #BE6A0A; }") 153 | 154 | ce = QPushButton("CE", self) 155 | ce.move(5, 110) 156 | ce.resize(70, 70) 157 | ce.clicked.connect(self.ce) 158 | ce.setStyleSheet( 159 | "QPushButton { background-color: #1C1C1C; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #505050; }") 160 | 161 | root = QPushButton("√", self) 162 | root.move(125, 110) 163 | root.resize(70, 70) 164 | root.clicked.connect(self.root) 165 | root.setStyleSheet( 166 | "QPushButton { background-color: #1C1C1C; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #505050; }") 167 | 168 | c = QPushButton("C", self) 169 | c.move(65, 110) 170 | c.resize(70, 70) 171 | c.clicked.connect(self.c) 172 | c.setStyleSheet( 173 | "QPushButton { background-color: #1C1C1C; font-size: 20px; border-style: solid; border-width: 1px; margin-left: 7px; margin-top: 4px; margin-right: 6; margin-bottom: 8px } QPushButton:pressed { background-color: #505050; }") 174 | 175 | self.show() 176 | 177 | def point(self): 178 | if "." not in self.line.text(): 179 | self.line.setText(self.line.text() + ".") 180 | 181 | def ce(self): 182 | self.line.backspace() 183 | 184 | def c(self): 185 | global NUM 186 | global NEW_NUMBER 187 | global RESULT 188 | global SYMBOL 189 | 190 | self.line.clear() 191 | NUM = 0.0 192 | NEW_NUMBER = 0.0 193 | RESULT = 0.0 194 | SYMBOL = "" 195 | 196 | def root(self): 197 | try: 198 | NUM = float(self.line.text()) 199 | except ValueError: 200 | return 201 | NUM = sqrt(NUM) 202 | self.line.setText(str(NUM)) 203 | 204 | def show_numbers(self): 205 | global NUM 206 | global NEW_NUMBER 207 | global OPERATION 208 | 209 | sender = self.sender() 210 | NEW_NUMBER = int(sender.text()) 211 | set_num = str(NEW_NUMBER) 212 | 213 | if OPERATION == False: 214 | self.line.setText(self.line.text() + set_num) 215 | else: 216 | self.line.setText(set_num) 217 | OPERATION = False 218 | 219 | def symbol(self): 220 | global SUM_IT 221 | global NUM 222 | global OPERATION 223 | global SYMBOL 224 | 225 | SUM_IT += 1 226 | 227 | if SUM_IT > 1: 228 | self.equal() 229 | 230 | NUM = self.line.text() 231 | sender = self.sender() 232 | SYMBOL = sender.text() 233 | 234 | OPERATION = True 235 | 236 | def equal(self): 237 | global NUM 238 | global NEW_NUMBER 239 | global RESULT 240 | global SYMBOL 241 | global OPERATION 242 | global SUM_IT 243 | 244 | SUM_IT = 0 245 | 246 | NEW_NUMBER = self.line.text() 247 | if SYMBOL == "+": 248 | RESULT = float(NUM) + float(NEW_NUMBER) 249 | elif SYMBOL == "-": 250 | RESULT = float(NUM) - float(NEW_NUMBER) 251 | elif SYMBOL == "x": 252 | RESULT = float(NUM) * float(NEW_NUMBER) 253 | elif SYMBOL == "÷": 254 | RESULT = float(NUM) / float(NEW_NUMBER) 255 | 256 | self.line.setText(str(RESULT)) 257 | OPERATION = True 258 | 259 | 260 | if __name__ == '__main__': 261 | APP = QApplication(sys.argv) 262 | ex = Calculator() 263 | sys.exit(APP.exec_()) 264 | -------------------------------------------------------------------------------- /show_BeautifyCamera.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_BeautifyCamera.jpg -------------------------------------------------------------------------------- /show_Browser.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_Browser.jpg -------------------------------------------------------------------------------- /show_Calculator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_Calculator.jpg -------------------------------------------------------------------------------- /show_ImageEdit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_ImageEdit.jpg -------------------------------------------------------------------------------- /show_MusicPlayer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_MusicPlayer.jpg -------------------------------------------------------------------------------- /show_NotePad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_NotePad.jpg -------------------------------------------------------------------------------- /show_Painting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_Painting.jpg -------------------------------------------------------------------------------- /show_PyTunes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_PyTunes.jpg -------------------------------------------------------------------------------- /show_RandomPassword.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/show_RandomPassword.jpg -------------------------------------------------------------------------------- /绘画/images/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /绘画/images/blue-folder-open-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/blue-folder-open-image.png -------------------------------------------------------------------------------- /绘画/images/border-weight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/border-weight.png -------------------------------------------------------------------------------- /绘画/images/cake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/cake.png -------------------------------------------------------------------------------- /绘画/images/disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/disk.png -------------------------------------------------------------------------------- /绘画/images/document-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/document-image.png -------------------------------------------------------------------------------- /绘画/images/edit-bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/edit-bold.png -------------------------------------------------------------------------------- /绘画/images/edit-italic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/edit-italic.png -------------------------------------------------------------------------------- /绘画/images/edit-underline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/edit-underline.png -------------------------------------------------------------------------------- /绘画/images/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/edit.png -------------------------------------------------------------------------------- /绘画/images/eraser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/eraser.png -------------------------------------------------------------------------------- /绘画/images/layer-shape-ellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/layer-shape-ellipse.png -------------------------------------------------------------------------------- /绘画/images/layer-shape-line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/layer-shape-line.png -------------------------------------------------------------------------------- /绘画/images/layer-shape-polygon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/layer-shape-polygon.png -------------------------------------------------------------------------------- /绘画/images/layer-shape-polyline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/layer-shape-polyline.png -------------------------------------------------------------------------------- /绘画/images/layer-shape-round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/layer-shape-round.png -------------------------------------------------------------------------------- /绘画/images/layer-shape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/layer-shape.png -------------------------------------------------------------------------------- /绘画/images/magnifier-zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/magnifier-zoom.png -------------------------------------------------------------------------------- /绘画/images/paint-brush.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/paint-brush.png -------------------------------------------------------------------------------- /绘画/images/paint-can-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/paint-can-color.png -------------------------------------------------------------------------------- /绘画/images/paint-can.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/paint-can.png -------------------------------------------------------------------------------- /绘画/images/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/pencil.png -------------------------------------------------------------------------------- /绘画/images/pipette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/pipette.png -------------------------------------------------------------------------------- /绘画/images/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/printer.png -------------------------------------------------------------------------------- /绘画/images/selection-poly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/selection-poly.png -------------------------------------------------------------------------------- /绘画/images/selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/selection.png -------------------------------------------------------------------------------- /绘画/images/spray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/spray.png -------------------------------------------------------------------------------- /绘画/images/stamp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/images/stamp.png -------------------------------------------------------------------------------- /绘画/stamps/a: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /绘画/stamps/pie-apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-apple.png -------------------------------------------------------------------------------- /绘画/stamps/pie-cherry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-cherry.png -------------------------------------------------------------------------------- /绘画/stamps/pie-cherry2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-cherry2.png -------------------------------------------------------------------------------- /绘画/stamps/pie-lemon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-lemon.png -------------------------------------------------------------------------------- /绘画/stamps/pie-moon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-moon.png -------------------------------------------------------------------------------- /绘画/stamps/pie-pork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-pork.png -------------------------------------------------------------------------------- /绘画/stamps/pie-pumpkin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-pumpkin.png -------------------------------------------------------------------------------- /绘画/stamps/pie-walnut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JackHCC/Mini-Tools/231ea09044faed9e3c05c7cb94537ed893d00ee0/绘画/stamps/pie-walnut.png --------------------------------------------------------------------------------