-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_ico.py
More file actions
28 lines (24 loc) · 836 Bytes
/
Copy pathgenerate_ico.py
File metadata and controls
28 lines (24 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
"""Generate IPQuery icon .ico for Windows"""
import sys, os
from PyQt6.QtWidgets import QApplication
from PyQt6.QtCore import Qt, QRectF
from PyQt6.QtGui import QPainter, QColor, QFont, QPixmap
app = QApplication(sys.argv)
OUT_DIR = sys.argv[1] if len(sys.argv) > 1 else "."
px = QPixmap(256, 256)
px.fill(Qt.GlobalColor.transparent)
p = QPainter(px)
p.setRenderHint(QPainter.RenderHint.Antialiasing)
p.setBrush(QColor("#3498db"))
p.setPen(Qt.PenStyle.NoPen)
p.drawEllipse(10, 10, 236, 236)
p.setBrush(QColor("#ffffff"))
p.drawEllipse(50, 50, 156, 156)
p.setFont(QFont("Arial", 56, QFont.Weight.Bold))
p.setPen(QColor("#2c3e50"))
p.drawText(QRectF(0, 70, 256, 100), Qt.AlignmentFlag.AlignCenter, "IPQ")
p.end()
path = os.path.join(OUT_DIR, "ipquery.ico")
px.save(path, "ICO")
print(f"Icon generated: {path}")