As part of the software development process, students, of course, program their applications within a GUI in order to create an actual executable file of the application.
In Python, PyInstaller is used. Not perfect, but it seems to do the job more often than not. Here is another helpful site. PyInstaller is good for both Mac .app executables and .exe for Win. The only disadvantage is that the platform executable is created based on which platform it is created. So, on a Mac, only the .app, on a PC, only .exe. To create executables for both, I have a Mac laptop to create the .app.
For both PC and Mac, the command prompt or terminal is used to install PyInstaller. The PC requires the installation of PyWin32.
VERY IMPORTANT observations regarding PyInstaller!
1. Extract PyInstaller onto desktop/install PyWin32 (WIN)
2. Use command prompt or terminal to install
3. Make certain that the images or any resources paths are absolute, not relative
eg. image0=tk.PhotoImage(file="/Users/Comp_name/MyApp/image.gif")
installation:
>> cd Desktop
>> cd PyInstaller-3.2
>> sudo python setup.py install (Use 'sudo' for Macs. Admin command prompt for Windows)
packaging:
>>python pyinstaller --onefile --onedir --windowed --name=myAppName myApp.py
A 'dist', 'build', and .spec file is created in the project director. The executable is in the 'dist' folder.
Include --icon=icon.ico in prompt to include an icon for the executable. The image must be in .ico format for Windows. Icons (.icns) for Mac.
Here are two online image converters for PC...Mac.
http://image.online-convert.com/convert-to-ico (for PC)
https://iconverticons.com/online/ (for Mac)
Eclipse and BlueJ are used to create executable jar files. Launch4j is used to convert the jar files to executables for Win. Packr is under review for its potential for packaging for all platforms.
Also, here, additional instructions on how to create jar files using command line, Eclipse and BlueJ.
No comments:
Post a Comment