psgshortcut
Create a "Shortcut" to your application so that you have an icon that can be double-clicked or pinned to your taskbar
Installation
python -m pip install psgshortcut
or
python3 -m pip install psgshortcut
GitHub Repo Location
https://github.com/PySimpleGUI/psgshortcut
Launching
From the command line:
psgshortcut
Purpose
If you are writing PySimpleGUI programs, or any GUI program, then you have a powerful option available to you... you can double-click an icon to launch your application just like any "normal" Windows/Mac/Linux program that is launched in a windowing environment.
"Authored in, but not limited to PySimpleGUI"
Like many of the utilities that have been released as part of the PySimpleGUI project, they were developed using PySimpleGUI, but their use is not limited to PySimpleGUI-based project. psgshortcut
is a good example of this.
psgshortcut
was written in PySimpleGUI, but the programs you are creating a shortcut to do not have to be written using PySimpleGUI. They can be any Python program.
Create a Shortcut To This Program
Use this program to make a shortcut to itself so that you can then put on your desktop or pin to your taskbar or ???
To do this, follow these steps:
- Open a command window (I promise, it's the last time you'll need to for this program)
- Type -
where psgshortcut
- Copy the line that
where psgshortcut
gave you into the first input of the shortcut maker program - Run psgshortcut by typing
psgshortcut
in your command window - Right click and choose "File Location"
- Copy the file location results, but change the extension from .py to .ico and paste into the Icon file input of the shortcut maker
- Click "Create Shortcut"
This will create a shortcut in the same folder as the target file. You can safely move this shortcut file to any place you want (like to your desktop). Double-click the shortcut and your program should launch.
Make Shortcuts To Anything
You can not only make shortcuts to Python programs, but you can make shortcuts to EXE and other files. The GUI is self-explanatory. Fill in the inputs, click the Make Shortcut button and you'll find the shortcut in the same folder as the target program.
Why Use A Shortcut?
You could directly double-click your .pyw file, but the icon you see in file explorer will be the standard "Python icon". If you want your program to show up in explorer with a custom icon... one that matches your PySimpleGUI for example, then you need to create a shortcut. A shortcut allows you to assign an icon to it.
Additionally, if you've ever tried to "pin" a running PySimpleGUI program to your taskbar, you'll find that the generic Pythonw executable is pinned. When you click this pinned icon, it will not launch your PySimpleGUI program.
To pin to the taskbar, you'll need to follow these instructions...
Important Note - Pinning To Taskbar Requires "Python Command"
If you wish to pin your shortcut to the taskbar, then be sure to fill in the "Python Command" field with the full path to your pythonw.exe file. Without it you'll get "IDLE" as the program that's pinned. You can skip filling in this field if you're going to place the shortcut on your desktop or other location.