DEV Community

Dhruv Anand
Dhruv Anand

Posted on

Python Tkinter Standalone Application

If any one has made a TKinter application and wants to convert it to an executable, here's how you can do it.

For this, we will be using Pyinstaller

Installing Pyinstaller

pip install pyinstaller

Converting to Executable

Once you have installed Pyinstaller, there is just one more step remaining.

  • Locate to the directory where your .py file is located. (The Python program you want to convert to application)
  • Open the Command Prompt in that directory.
    • Quick Tip: in the File Explorer, click on the Address Bar and type cmd to open the Command Prompt in that directory.
  • After that, type this command in the Command Prompt pyinstaller --onefile --windowed --icon=<your-icon.ico> <>

Explaining the command:

  • pyinstaller : To bundle the Python application and all its dependencies into a single package.
  • --onefile : To have just one Executable file.
  • --windowed : This will not open the Terminal every time you run the app.
  • icon : Set the icon of the app.
  • Write the name of your file to be converted to an Executable.

If this helped you, you can follow me on GitHub and have a look at my projects and star them.

Discussion (0)