build: Add PyInstaller standalone build scripts and app icon

This commit is contained in:
najeeb 2026-05-09 02:12:04 +05:00
parent 08c3d373e3
commit 564886bf90
4 changed files with 48 additions and 0 deletions

6
.gitignore vendored
View File

@ -28,3 +28,9 @@ desktop.ini
# Logs
*.log
# App Config
config.json
# PyInstaller
*.spec

BIN
app.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

23
build.py Normal file
View File

@ -0,0 +1,23 @@
import PyInstaller.__main__
import tkinterdnd2
import os
import shutil
def build():
tkdnd_path = os.path.join(os.path.dirname(tkinterdnd2.__file__), 'tkdnd')
# Ensure dist and build dirs are clean
if os.path.exists('dist'): shutil.rmtree('dist')
if os.path.exists('build'): shutil.rmtree('build')
PyInstaller.__main__.run([
'kobackupdec_gui.py',
'--name=KoBackupDecryptor',
'--onefile',
'--windowed',
'--icon=app.ico',
f'--add-data={tkdnd_path};tkinterdnd2/tkdnd'
])
if __name__ == '__main__':
build()

19
create_icon.py Normal file
View File

@ -0,0 +1,19 @@
import sys
from PIL import Image
def create_ico(input_path, output_path):
img = Image.open(input_path)
# Crop to square if necessary
width, height = img.size
if width != height:
min_dim = min(width, height)
left = (width - min_dim) / 2
top = (height - min_dim) / 2
right = (width + min_dim) / 2
bottom = (height + min_dim) / 2
img = img.crop((left, top, right, bottom))
img.save(output_path, format="ICO", sizes=[(256, 256), (128, 128), (64, 64), (32, 32), (16, 16)])
if __name__ == "__main__":
create_ico(sys.argv[1], sys.argv[2])