Skip to content

Commit fa85471

Browse files
committed
1.4
1 parent 1e05d9b commit fa85471

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

build.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# build.py
2+
import os
3+
import subprocess
4+
5+
def build_exe():
6+
command = [
7+
"pyinstaller",
8+
"--onefile",
9+
"--windowed", # 如果你的程序没有命令行界面,可以使用 --windowed 隐藏控制台
10+
# 添加其他选项,如 --icon=your_icon.ico
11+
]
12+
13+
# 添加数据文件夹
14+
data_folders = [
15+
"sounds", "music", "menu", "arrow", "icons", "stratagem", "fonts"
16+
]
17+
for folder in data_folders:
18+
command.append(f"--add-data={folder}{os.sep}*;{folder}")
19+
20+
command.append("main.py") #放在最后
21+
22+
# 执行命令
23+
subprocess.run(command)
24+
print(command)
25+
26+
if __name__ == "__main__":
27+
build_exe()

0 commit comments

Comments
 (0)