Stand-alone app with PyInstaller

October 15, 2021

Last post I’ve build a GUI calculator from an online class and added some extra functions to it. This post I’ll be creating the app as a stand-alone app for Mac and one for Windows.

I’m using PyInstaller to do this, this is a stand-alone app you use in the command line/terminal to have it bundle the app together so you can give it to somebody else to run. Very useful if you’re building an app for a client in a GUI interface and want to give them an app that looks like a real app. This will give them a basic interface that looks like other basic apps they run on their OS.

I saved my calculator into a separate folder, there will be several extra files during the creation. My calculator file is called ‘calculator.py’, if you have an image to show for the app, place there here also.

In terminal/command prompt:

Go to the directory/folder you have the file located:

cd <filepath>
pyinstaller --onefile --icon=favicon.ico --noconsole calculator.py

pyinstaller = calling the program to run, then below we’re passing arguments to pyinstaller
–onefile = to combine into one file
–icon= = point to the icon you have listed in the app
–noconsole = stops a terminal window from displaying when app loads
calculator.py = Name of Python program to be used, this needs to be the last in the list.

PyInstaller Manual: https://pyinstaller.readthedocs.io/en/stable/

Downloads of the calculator. This calculator is just a sample to show that a Python program can be created to a stand-alone app. This app has not fully been tested, use a regular calculator app to do for real world work.

Added this warning to the bottom of the program window, in case with search engines take somebody straight to the download of the file I don’t want them to have any issues if there is any bad calculations from the test app.

WARNING!!
This is just a test version to show Tkinter and Pyinstaller for Python, this program is for demonstrative purposes only!”

Mac Version
Windows Version

Windows version: https://lynnamacher.com/programs/calculator.exe.zip
Mac version: https://lynnamacher.com/programs/calculator.app.zip

Full code on GitHub: https://github.com/amacher/calculator

Related Articles

Tic-Tac-Toe in JavaScript

Tic-Tac-Toe in JavaScript

To take a break from the other projects this weekend I worked on a Tic-Tac-Toe game in JavaScript. The basic instructions I had for myself was it needed to be able to be played by 1 or 2 people. I started with creating the game for 2 players. Thinking that if I can...

read more
Save posts to a WordPress Database – Working Notes

Save posts to a WordPress Database – Working Notes

This is notes/overview of a project I started on to add several posts to WordPress (WP) from HTML files without having to copy and paste each file. These are just notes from that dropped project and the basic Python script to do this (github). Make sure you fully test...

read more
CMYK converter added

CMYK converter added

CMYK is a tricky one, since each device would interpret the colors differently. Had almost decided not to even include it but thought it could be useful at times. Looking around I found a basic formula that most people were using to give a rough idea for the color. I...

read more

Pin It on Pinterest

Share This