Wednesday, October 4, 2017

Creating Exe file from a python Tkinter file application.

Today we will discuss about creating exe file from python for making windows application.
For this the basic requirement is Python to be installed and working on SUT and then the pyinstaller being install in the system.

To install pyinstaller we can do -

pip install pyinstaller for windows user
sudo pip install pyinstaller for Linux user.

This pyinstalled builds an exe from the py file which user can run in windows platform.

To make this happen we need a python script that is made with Tkinter which is used for Python UI development for windows platform.

For Python 2.7 the name of the package is Tkinter for Python 3 its called tkinter.
Now after we have all our requirement fulfilled next step is to create the exe.

For that the simple command is

pyinstaller.exe --onefile --windowed  file_name.py

This is will start the packaging for the exe file. Note here one file means it will make a one file installer, other type of packaging system is also available with pyinstaller like folder package etc.
Windowed parameter tells tells the pyinstaller that the exe is a windowed process rather than a background process.

Two folder will be generated - dist is the main folder which will the have the exe file and which we can export or sell to customers.


Something look like below -





No comments: