更改非Nuitka程序图标设定

This commit is contained in:
星外之神 2022-06-03 19:41:50 +08:00
parent 1dd0894adf
commit 2c0dc94c75
4 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,7 @@ jobs:
--distpath ./out `
--noconsole `
--add-data="resources;./resources" `
--add-data="pypvz-exec-logo.png;./pypvz-exec-logo.png" `
-i ./pypvz.ico
- name: Release the version built by pyinstaller

BIN
pypvz-exec-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -8,6 +8,8 @@ GAME_RATE = 1
# 窗口标题
ORIGINAL_CAPTION = 'pypvz'
# 窗口图标
ORIGINAL_LOGO = "pypvz-exec-logo.png"
# 游戏模式
GAME_MODE = 'mode'

View File

@ -203,6 +203,10 @@ def loadPlantImageRect():
pg.init()
pg.display.set_caption(c.ORIGINAL_CAPTION) # 设置标题
SCREEN = pg.display.set_mode(c.SCREEN_SIZE) # 设置初始屏幕
try: # 设置窗口图标仅对非Nuitka时生效Nuitka不需要包括额外的图标文件自动跳过这一过程即可
pg.display.set_icon(pg.image.load(os.path.join(os.path.dirname(os.path.dirname(__file__)), c.ORIGINAL_LOGO)))
except Exception:
pass
GFX = load_all_gfx(os.path.join(os.path.dirname(os.path.dirname(__file__)) ,os.path.join("resources","graphics")))
ZOMBIE_RECT = loadZombieImageRect()