Skip to content

Commit f1be4f2

Browse files
committed
发布更新 v1.1.0
1. 更名Pythub Builder 2. 增加日志输出
1 parent ffbe126 commit f1be4f2

25 files changed

+627
-397
lines changed

README.md

Lines changed: 135 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,140 @@
1-
# PyThub PyInstaller Desktop
1+
# Pythub Builder - PyInstaller 图形化打包工具
22

3-
> GUI应用生成器
3+
![GUI界面示意图](resources/screenshots/1.png)
44

5+
## 项目概述
56

6-
一个 PyInstaller 的 GUI 实现,使用 Python 语言开发,GUI 基于 Tkinter,利用 PyInstaller 将 Python 脚本语言打包发布成单个的可执行程序
7+
一款基于 Tkinter 开发的图形化工具,用于简化 PyInstaller 打包 Python 脚本的操作。通过可视化界面配置打包参数,自动生成可执行文件,支持 Windows/Linux/macOS 多平台。
78

8-
预览图
9+
## 功能特性
10+
11+
- **核心功能**
12+
13+
- 📦 一键打包 Python 脚本为独立可执行文件
14+
- 🖼️ 支持自定义程序图标(.ico/.icns)
15+
- 📄 添加版本信息文件(.rc)
16+
- 📁 灵活设置工作目录和输出路径
17+
18+
- **配置选项**
19+
20+
- ✔️ 生成独立文件(--onefile)或文件夹包(--onedir)
21+
- ✔️ 关闭控制台窗口(--noconsole)
22+
- ✔️ UPX 压缩(--upx)
23+
- ✔️ 构建前清理临时文件(--clean)
24+
- ✔️ 自定义 EXE 文件名(--name)
25+
26+
- **辅助功能**
27+
- 📜 实时日志输出显示
28+
- 🚦 状态栏进度反馈
29+
- 🔄 表单重置与日志清理
30+
- 🛑 安全退出机制
31+
32+
## 使用说明
33+
34+
### 快速开始
35+
36+
```bash
37+
克隆仓库
38+
git clone https://github.com/Crogram-Pythub/pythub-builder.git
39+
40+
安装依赖
41+
pip install pyinstaller tkinter
42+
43+
启动应用
44+
python src/app.py
45+
```
46+
47+
### 操作指南
48+
49+
1. **选择主程序**
50+
51+
点击 "选择文件" 按钮指定要打包的 `.py` 文件
52+
53+
2. **配置路径**
54+
55+
- 工作目录:临时构建文件存放路径(默认:`项目路径/build`
56+
- 输出目录:最终 EXE 文件生成路径(默认:`项目路径/dist`
57+
58+
3. **高级设置**
59+
60+
- 勾选 "UPX 压缩" 减小文件体积(需提前安装 UPX)
61+
- 指定版本信息文件添加版权信息
62+
63+
4. **执行打包**
64+
65+
点击 "构建生成" 按钮启动打包流程,实时日志将显示构建进度
66+
67+
## 配置参数对照表
68+
69+
| 界面选项 | PyInstaller 参数 | 说明 |
70+
| ------------ | ---------------- | ------------------------------ |
71+
| 独立执行文件 | `--onefile` | 生成单个可执行文件 |
72+
| 文件夹包含 | `--onedir` | 生成包含依赖的文件夹 |
73+
| 关闭控制台 | `--noconsole` | 隐藏命令行窗口(GUI 程序必备) |
74+
| UPX 压缩 | `--upx` | 使用 UPX 压缩可执行文件 |
75+
| 构建前清理 | `--clean` | 清除缓存文件 |
76+
77+
## 依赖项
78+
79+
- Python 3.7+
80+
81+
- 必需库:
82+
83+
```requirements.txt
84+
PyInstaller==5.4.1
85+
tkinter==0.1.0
86+
```
87+
88+
## 代码结构
89+
90+
```
91+
pythub-builder/src
92+
├── src/app.py # 主程序入口文件
93+
├── src/view.py # 主程序界面和逻辑
94+
├── src/utils.py # 工具函数(窗口控制/路径检测/退出确认)
95+
├── resources # 资源文件(图标/截图)
96+
├── build.sh # 项目打包脚本
97+
└── README.md # 项目文档
98+
```
99+
100+
## 常见问题
101+
102+
**Q:打包时报错 "PyInstaller 未找到"**
103+
104+
✅ 解决方案:
105+
106+
```bash
107+
pip install --upgrade pyinstaller
108+
```
109+
110+
**Q:如何添加自定义图标?**
111+
112+
✅ 操作步骤:
113+
114+
1. 准备 256x256 像素的 `.ico` (Windows) 或 `.icns` (macOS) 文件
115+
2. 通过 "选择图标" 按钮加载图标文件
116+
117+
**Q:版本信息文件格式要求**
118+
119+
🔍 参考:[微软版本资源文件规范](https://docs.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource)[VERSIONINFO resource](https://learn.microsoft.com/zh-cn/windows/win32/menurc/versioninfo-resource)
120+
121+
## 问题反馈
122+
123+
Please file an issue at [Issues](https://github.com/Crogram-Pythub/pythub-builder/issues).
124+
125+
## 许可证
126+
127+
Pythub Builder is released under the [BSD 3-Clause License](LICENSE)
128+
129+
## 作者
130+
131+
[Jackson Dou](https://github.com/jksdou)
132+
133+
## 版权
134+
135+
© 2025 [Crogram](https://crogram.org/)
136+
137+
## 其他
138+
139+
网站:[pythub.org](https://pythub.org/)
9140

10-
![WX20201114-205346@2x](resources/screenshots/[email protected])

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# _*_ coding:utf-8 _*_
22

3-
pyinstaller -D -w -y --noconfirm build.spec
3+
pyinstaller -y --noconfirm build.spec

build.spec

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# -*- mode: python ; coding: utf-8 -*-
22

33
block_cipher = None
4-
APP_ID = 'org.pythub.pyinstaller-desktop'
5-
APP_NAME = 'PyInstaller Desktop'
6-
APP_NAME_DISPLAY = 'PyInstaller 桌面客户端'
7-
APP_APP = 'PyThub PyInstaller Desktop.app'
8-
APP_VERSION = '1.0.0'
9-
APP_BUILD = 1
10-
APP_COPYRIGHT = 'Copyright © 2020-present Jackson Dou All Rights Reserved.'
4+
APP_ID = 'org.pythub.builder'
5+
APP_NAME = 'Pythub Builder'
6+
APP_NAME_DISPLAY = 'Pythub Builder'
7+
APP_APP = 'PythubBuilder.app'
8+
APP_VERSION = '1.1.0'
9+
APP_BUILD = 11
10+
APP_COPYRIGHT = 'Copyright © 2025 Crogram All Rights Reserved.'
1111
# HIDDEN_IMPORTS = ['PyInstaller.__main__'] # 源文件的依赖模块
1212
EXCLUDES = ['altgraph', 'numpy', 'psutil', 'wheel', 'setuptools', 'PIL'] # 不需要打包的模块
1313
UPX = True # 如果有UPX安装(执行Configure.py时检测),会压缩执行文件(Windows系统中的DLL也会)
@@ -61,7 +61,7 @@ app = BUNDLE(coll,
6161
'CFBundleExecutable': APP_NAME,
6262
'CFBundlePackageType': 'APPL',
6363
'CFBundleSupportedPlatforms': ['MacOSX'],
64-
'CFBundleGetInfoString': 'Jackson Dou',
64+
'CFBundleGetInfoString': 'CROGRAM INC.',
6565
'CFBundleIdentifier': APP_ID,
6666
'CFBundleShortVersionString': APP_VERSION,
6767
'CFBundleVersion': APP_BUILD,

pkg.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
appName="PyThub PyInstaller Desktop"
3+
appName="PythubBuilder"
44
# MacDeveloperID="3rd Party Mac Developer Installer: Developer Name (XXXX)"
55
MacDeveloperID="Developer ID Installer: CROGRAM INC. (4LWSS9P873)"
66

resources/app.entitlements

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<!-- These are required for binaries built by PyInstaller -->
6+
<key>com.apple.security.app-sandbox</key>
7+
<true/>
8+
<key>com.apple.security.cs.disable-library-validation</key>
9+
<true/>
10+
</dict>
11+
</plist>

resources/app.icns

-6.98 KB
Binary file not shown.
1.62 KB
Loading
1.69 KB
Loading

resources/app.iconset/icon_16x16.png

312 Bytes
Loading
617 Bytes
Loading
1.69 KB
Loading
8.75 KB
Loading

resources/app.iconset/icon_32x32.png

617 Bytes
Loading
996 Bytes
Loading
8.75 KB
Loading
25.1 KB
Loading

resources/logo.curve

191 KB
Binary file not shown.

resources/logo.png

25.1 KB
Loading

0 commit comments

Comments
 (0)