I'm running Python 3.7 & Pyinstaller 3.6.
I created a script which uses Pygame.
The script will display a number of images when the user
clicks on a certain button.
All of the images are in a folder, called "Images".
There are over 20 separate image files in this folder.
For simplicity's sake, let's call these images
"a1.png", "a2.png", "a3.png", "a4.png", & "a5.png".
The script also uses audio files, one of which is a ".wav" file, & the other is a ".mp3" file.
These audio files are in a folder called "AudioStuff".
I've been trying to create an executable for my script for the past 2 weeks, but nothing seems to work.
I can now create an executable w/o any audio or video just fine.
I can also create an executable w/ the audio files.
I did this by using this code to my script:
def resource_path(relative_path):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)
return os.path.join(os.path.abspath("."), relative_path)
I also modified how I call Pyinstaller:
pyinstaller --onefile -w --add-data "myaudiofile1.wav;." --add-data "myaudiofile2.mp3;." script.py
This creates an executable which works.
However, how do I modify either my script, or how I call Pyinstaller,
so that I can also include multiple image files in a folder?
Thanks.
Update:
I found this link:
pyinstaller add folder with images in exe file
It helps w/ the image component, but how do I do audio too?