How do I convert my pygame program which has multiple python scripts and images to a exe?

前端 未结 2 1372
一向
一向 2020-12-20 00:29

I have 3 python scripts and many images in folders and tmx files which I want to make it as a single .exe . I wasnt able to find how to convert multiple python scripts and f

2条回答
  •  一个人的身影
    2020-12-20 01:07

    You can add external files to your pyinstaller exe by using add-data. An example I'm using for one of my pygame games:

    pyinstaller --onedir --clean --name "MyGame" --icon="images/icon.ico" --add-data "images/*.png:images" --add-data "sounds/*.mp3:sounds" --add-data "sounds/*.wav:sounds" --add-data "fonts/*.ttf:fonts" main.py
    

提交回复
热议问题