|
1 | 1 | # Python-Script-to-Application
|
2 | 2 |
|
3 |
| -To create an .exe [application] file from a python script |
4 |
| - |
5 |
| - |
6 |
| - # Precautions : |
| 3 | +**To create an (.exe) executable application file from a python script** |
7 | 4 |
|
| 5 | +## Precautions : |
8 | 6 |
|
9 |
| - * Save the resources in one folder, Do not save the folder inside another folder [ It will not give full |
10 |
| - |
11 |
| - permission to execute the commands. # ParentContainsErrorRecordException] |
| 7 | +:heavy_check_mark: Save the resources in one folder, Do not save the folder inside another folder. |
| 8 | +> *It will not give full permission to execute the commands. # ParentContainsErrorRecordException* |
12 | 9 |
|
13 |
| - * Check Spellings Before Running the commands, Do not put any Space in your main python programme Name. [# File not found show] |
14 |
| - |
15 |
| - * Do not use the " icon " word as a name of yours. ICO [icon] file; always use a different name. [ # It will show no icon file found] |
| 10 | +:heavy_check_mark: Check Spellings before running the commands, Do not put any _space_ in your main python (.py) programme file name. |
| 11 | +> *File not found show* |
| 12 | +
|
| 13 | +:heavy_check_mark: Do not use the _icon_ word as a name of your icon (.ico) file, always use a different name. |
| 14 | +> *It will show no icon file found.* |
16 | 15 |
|
17 |
| - * Do not Close Powershell window until "Building EXE from EXE-00.toc completed successfully" Message not shows. |
| 16 | +:heavy_check_mark: Do not Close Powershell window until **Building EXE from EXE-00.toc completed successfully** Message not shows. |
18 | 17 |
|
| 18 | +## Steps : |
19 | 19 |
|
20 |
| - # Steps : |
| 20 | +1.Install **[Inno Setup Compiler](main/tools/innosetup-6.1.2.exe)** free application and Pyinstaller. </br> |
21 | 21 |
|
| 22 | + Open **windows shell** and run : |
| 23 | + |
| 24 | +``` |
| 25 | + pip install pyinstaller |
| 26 | + |
| 27 | +``` |
| 28 | +2. Save Python script with all the resources in one folder. |
22 | 29 |
|
23 |
| -1. Install [Inno Setup Compiler](https://github.com/Abhijeetbyte/Python-Script-to-Application/raw/main/tools/innosetup-6.1.2.exe) free application and Pyinstaller. |
| 30 | +3. Open folder and press 'Shift + right click' select **Open PowerShell window** |
24 | 31 |
|
25 |
| - Open Cmd and run this line-> |
26 |
| - |
27 |
| - * pip install pyinstaller |
28 | 32 |
|
29 |
| -2. Create an .ICO [icon ] file, Save Python script with all the resources in the same folder. |
| 33 | +Run below commnads: |
30 | 34 |
|
31 |
| -3. Open folder and press 'Shift + right click' select and run 'Open PowerShell window' |
| 35 | +* If no custom icon file were used. |
| 36 | +``` |
| 37 | +pyinstaller myprogram.py |
| 38 | +``` |
32 | 39 |
|
33 |
| - Run this line-> |
| 40 | +* With custom icon file **(-F -i "mylogo.ico" command)** |
34 | 41 |
|
35 |
| - * pyinstaller -F -i "myicon.ico" myscriptname.py |
36 |
| - |
| 42 | +``` |
| 43 | +pyinstaller -F -i "mylogo.ico" myprogram.py |
37 | 44 |
|
38 |
| - * [ myicon.ico = icon file name myscriptname.py = Python file name ] |
| 45 | +``` |
| 46 | +* ( mylogo.ico = icon file name, myprogram.py = Python file name ) |
39 | 47 |
|
40 | 48 |
|
41 |
| -3. 1 if you want your executable application with no console running behind your |
42 |
| - application then go with the below line |
| 49 | +* If you want your executable application with no console running **(--noconsole command)** behind your application then go with the below line |
43 | 50 |
|
44 |
| - * pyinstaller -F -i "myicon.ico" myscriptname.py --onefile --noconsole |
45 |
| - * |
46 |
| - |
47 |
| -3. 2 if you want your executable application with additional file (--add-data command) and no console running behind your |
48 |
| - application then go with the below line |
| 51 | +``` |
| 52 | +pyinstaller -F -i "mylogo.ico" myprogram.py --onefile --noconsole |
| 53 | +
|
| 54 | +``` |
| 55 | + |
| 56 | +* If you want your executable application with additional file **(--add-data command)** then go with the below line. |
49 | 57 |
|
50 |
| - * pyinstaller -F -i "myicon.ico"--add-data "AdditionalImage.png;." myscriptname.py --noconsole |
| 58 | +``` |
| 59 | +pyinstaller -F -i "mylogo.ico"--add-data "Additionalimage.png;." myprogram.py --noconsole |
| 60 | +``` |
| 61 | +4. Go to **dist** folder and get application file, delete remain file except for resources.</br> |
51 | 62 |
|
52 |
| -4. Go to " dist " folder and get application file, delete remain file except for resources. |
| 63 | +**Congratulations ! 🤩 you successfully created your standalone application.**</br> |
53 | 64 |
|
54 |
| -5. Open Inno setup to make .exe file which is Installable /Executable in Windows PC, select ‘ Create a new script file using script |
55 |
| - Wizard ' and browse to select your application. |
| 65 | +*However if you want your application as Setup.exe then windows installer will extract the installation resources from itself and manage their installation directly*.</br> |
56 | 66 |
|
57 |
| -6. Select all required things for your application # Icon of setup file # Before installation document # Licence .etc |
58 |
| - |
59 |
| -7. Click ' Yes ' to all, in the End, go to Output Folder get 'setup file' of application and click on open to install. |
| 67 | +5. Open Inno setup to make (.exe) file which is Installable/Executable in Windows PC, select **Create a new script file using script |
| 68 | + Wizard** and browse to select your application. |
60 | 69 |
|
| 70 | +6. Select all required things for your application such as Icon of setup file, Before installation document, Licence .etc |
| 71 | + |
| 72 | +7. Click **Yes** to all, in the end, go to Output Folder get **setup file** of application and click on open to install.</br> |
| 73 | + |
| 74 | +**Yor're done !**</br> |
| 75 | +### Refrences |
| 76 | +* [Pyinstaller](https://pyinstaller.readthedocs.io/en/stable/operating-mode.html) |
| 77 | +* [Inno Setup Compiler](https://jrsoftware.org/isdl.php)</br> |
| 78 | +* Feel free to report <b>[issues](https://github.com/Abhijeetbyte/Volume-Calculator/issues/new)</b> |
| 79 | + |
0 commit comments