I developed a GUI app in Python 3. I want to be able to launch it by clicking on the script itself or in a custom-made launching script. I have changed permissions and it's now opening with "Python Launcher" on double-click. But everytime I run my app, I get a lot of windows:
My Python application (that's the only one I need to be on screen)
The Python launcher preferences (I could live with this one, but would prefer it to be hidden)
A Terminal window with the default shell (don't need this one)
Another Terminal window showing the output of the app (like print
, errors... I don't want this window)
What is the easiest way to get only the GUI on screen, without any Terminal windows?
Following the suggestion bu linusg, I discovered that I can accomplish this by creating an AppleScript application with the following code (adjusting the paths of python3 and of the Python application as needed):
do shell script "export LC_ALL=en_US.UTF-8; export LANG=en_US.UTF-8; /usr/local/bin/python3 '/Users/USER/FOLDER/SCRIPT.py' &> /dev/null &"
It launches the Python application without Terminal Windows. The AppleScript application can then be personalised with a custom icon as usual, and can be placed in the Dock. When clicked, it will launch the Python intepreter, that still shows up in Dock, but with no visible windows.
I think this may be useful to other users.