OS menu shortcuts, correct taskbar behaviour, and environment activation for Python GUI apps
Project description
desktop-app
desktop-app
simplifies making a Python GUI application install, launch, and behave in
a standard way with respect to the application menus and the taskbar in Windows and
Linux (Macos support planned).
If your application is a Python module runnable from the command line as python -m mymodule
, then with minimal configuration desktop-app
can:
- Create a launcher script (or
.exe
on windows) that runs your application- after activating a
conda
env or virtual environment, if any - with a hidden console if on Windows
- after activating a
- Install a start menu shortcut (Windows) or
.desktop
file (Linux) to launch your application from your desktop applications menu - Ensure your application appears in the taskbar with the correct name and icon, and can be pinned correctly.
Basic Usage
Here we'll follow the example in this repository for a module called oink
, developed
by Old MacDonald's Farm. Before Old MacDonald had heard of desktop-app
, he had a
package that looked like this:
.
├── oink
│ ├── __init__.py
│ └── __main__.py
└── setup.py
Where setup.py
is:
from setuptools import setup
setup(
name='oink',
version='1.0',
author='Old MacDonald',
author_email="macdonald@eie.io",
url='http://eie.io',
packages=["oink"],
setup_requires=['setuptools'],
)
__main__.py
is:
import tkinter
root = tkinter.Tk()
root.geometry("300x300")
w = tkinter.Label(root, text="Oink!")
w.place(relx=0.5, rely=0.5, anchor=tkinter.CENTER)
root.mainloop()
And __init__.py
is empty.
After installing this package somewhere, MacDonald can run it from a terminal with
python -m oink
, and it shows a little window
[README still in progress!]
Reasons
Why a hidden console on Windows?
The usual recommendation to run Python GUI applications is with Pythonw.exe
, which
does not create a console window. However, when running under Pythonw.exe
, a simple
print()
call will raise an exception, and certain low-level output
redirection
of subprocesses does not work due to the stdout
and stderr
filehandles not existing.
Furthermore, some tools may create subprocesses that call cmd.exe
, or Python.exe
,
briefly popping up console windows of their own since one doesn't already exist.
In order to be able to ignore these problems and code the same as you would with a
console, in Windows the launcher script runs your application in a subprocess using
Python.exe
, but with the CREATE_NO_WINDOW
flag so that the console exists, but is
not visible.
Why activate environments?
Activating environments is not strictly necessary except when using conda on Windows, in which case some compiled extensions (notably, Qt libraries) cannot be imported unless the environment is active.
However, even on other platforms activating the environment simplifies running other
programs that might be installed to the bin
/Scripts
directory of the virtual
environment - calling code would otherwise have to manually find this directory and
provide the full path to the programs it wants to run.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file desktop-app-0.2.8.tar.gz
.
File metadata
- Download URL: desktop-app-0.2.8.tar.gz
- Upload date:
- Size: 56.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac921cbf18b9dccefe8c88e9cb95a0ea6d039705167a460e5a6004a9ea7150dd |
|
MD5 | b5b548e123ecfcb5447ca4a028416046 |
|
BLAKE2b-256 | a329b20c743856d13209b815c2210553aadbf2b0ee6f98e9adf32efeb2035442 |
File details
Details for the file desktop_app-0.2.8-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 23.2 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c9198f6d0592c13cabf3070a40ff88fabd8249cdf45a287ade48540835ce2b9 |
|
MD5 | 9b4b9f7b3d8138e99c387960508f7898 |
|
BLAKE2b-256 | 47d7ca4c6a12fa511aeb15bc6e32c70081e3c6e84db5d8e972e4c2c4e32ef97f |
File details
Details for the file desktop_app-0.2.8-cp39-cp39-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp39-cp39-win32.whl
- Upload date:
- Size: 22.7 kB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2561da50db4ed5fa88b7436b015683bd0900885d92835878da853a1e4bdbc6e3 |
|
MD5 | f4b9b8a025bbddbaec238fd2f07bc368 |
|
BLAKE2b-256 | 2be66fccf4ebeeb37771fb2cdc24f8a14914c2445b819d3e024cbb59ab365cc1 |
File details
Details for the file desktop_app-0.2.8-cp39-cp39-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp39-cp39-manylinux2010_x86_64.whl
- Upload date:
- Size: 38.6 kB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3406ecdb91b55cd22f5db48682f5b36e98c889194e86dcdf49e54bd5baf01f78 |
|
MD5 | e4b801a3ff951a691ae32ee3b5d89bb4 |
|
BLAKE2b-256 | cf3bc770adb33a8b794f9f712b857e1f6815a41d6327564a5ca747b68c552c1c |
File details
Details for the file desktop_app-0.2.8-cp39-cp39-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp39-cp39-manylinux1_x86_64.whl
- Upload date:
- Size: 38.6 kB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5794b9d06dd984fd1cf5815a98adc683cea56e690f592ccdb11b81d44413013e |
|
MD5 | 2b9db96baddbc1e0e10ee31d51ad960f |
|
BLAKE2b-256 | e2ac6a069dd923f1132ea93523fbd3e9961deedb9191eb3de706bc2bba69e849 |
File details
Details for the file desktop_app-0.2.8-cp39-cp39-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp39-cp39-macosx_10_14_x86_64.whl
- Upload date:
- Size: 18.8 kB
- Tags: CPython 3.9, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8477fe580d3bb80435d66a8efa8c75a2b3a09cbe2477d62062e07b771ee186d |
|
MD5 | 032b114b4de0223b2ae00f3a943463a8 |
|
BLAKE2b-256 | 9e164c76e3195e1c3756ae957f1880cd399baee2ce621c6a407fe2ac2944194b |
File details
Details for the file desktop_app-0.2.8-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 23.3 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a51a05f560a7355a4587832f0bfa51252f705b00fdd4245f971a3f3f5fb42e0 |
|
MD5 | a50b708c39ae871baada0f1abcf19f1a |
|
BLAKE2b-256 | 6ff9f30782dcd2dc0dbc3d5110209061e74b60907a38a343b75e334616790481 |
File details
Details for the file desktop_app-0.2.8-cp38-cp38-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp38-cp38-win32.whl
- Upload date:
- Size: 22.8 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dafe686f9add5ff3765fbe0b48a914afbafa6ec45f506c935de353fbf71f9409 |
|
MD5 | 106e96dc5338807f42a214f33fee4716 |
|
BLAKE2b-256 | 0cc3dad613e3ee2d3908a0ee45c271482fbeb576071f5155c89e15bf36f2b74e |
File details
Details for the file desktop_app-0.2.8-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 38.8 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fa76212c4211ac61d6d3939807053765db0a27279af8fc520aaa564e1696490 |
|
MD5 | f8f43d342c6523fd294fcc08a4ac577c |
|
BLAKE2b-256 | 174d688a492634316a6a2ca78225810bf9f4b8911aad532b9fb3821c78198112 |
File details
Details for the file desktop_app-0.2.8-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 38.8 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c491568a5f8699afaf46f3491e3eea0a0cc09f8a3ce788d007ff17124bd90bd |
|
MD5 | 76739e86568cf16f94b1c2af40fd2496 |
|
BLAKE2b-256 | 99cad4332691658d79117f7b8ee6bc1b83331a8d23e010255bb0751b69ba08e1 |
File details
Details for the file desktop_app-0.2.8-cp38-cp38-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp38-cp38-macosx_10_14_x86_64.whl
- Upload date:
- Size: 18.8 kB
- Tags: CPython 3.8, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc29df66e4354817990b998f2c3513bd2a0a14b034301faeeab49d60ade2e4cd |
|
MD5 | 36a65bf5689bf2be8bf7e319e1d118d6 |
|
BLAKE2b-256 | ca76e15a219fcaa06481b9829d3f86e578223874ead21924e6f005e36fdcc3d1 |
File details
Details for the file desktop_app-0.2.8-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 23.2 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2747625ef586bdbdd8dae2aa55c960115e09d162ef8ce87b0b162514eb9494b6 |
|
MD5 | b76eaf69716941ff4e869fb6906f2523 |
|
BLAKE2b-256 | 140579082c0b75e0e8fc3badf3faa718d4acaf98df96db4ed1f4d19efa451510 |
File details
Details for the file desktop_app-0.2.8-cp37-cp37m-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp37-cp37m-win32.whl
- Upload date:
- Size: 22.7 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07674db82f03dba2a73d87caeefcfcdbc038812b7f8747f5a0fe8795f99ec80c |
|
MD5 | 952de47c0272d67827ae408a8ffb6e30 |
|
BLAKE2b-256 | df8c6976e19bdba73e9fab29138d435384d3af93230c3802401e0cf1ba28210d |
File details
Details for the file desktop_app-0.2.8-cp37-cp37m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp37-cp37m-manylinux2010_x86_64.whl
- Upload date:
- Size: 39.9 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ae7bbbc3b2230679b8c59baabb4ffd8d7f6e505639d4b93aff21f8363b10562 |
|
MD5 | 6c907ecfcf5513b8172de3551625f2ff |
|
BLAKE2b-256 | 107064e93c7ee85e0871932760ed61157f80ac64fe8292116071f915810d123b |
File details
Details for the file desktop_app-0.2.8-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 39.9 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4d1ac90cdd2967e2aae98ff2fbb6144cc3b4062e47ee595c4e9bdcc9bcc0afd |
|
MD5 | d96e802bd96f4c136c94bff403f8456e |
|
BLAKE2b-256 | 764233184e80db2ba09193975fe6c478a7d8da72164b43636c4b4ad7d183fc64 |
File details
Details for the file desktop_app-0.2.8-cp37-cp37m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 18.8 kB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36ea9738c935a112f115cddc84bd87a41c9880154c48ad717e3ed6a2879bf693 |
|
MD5 | d906ecc2d582ed33c5ce56dece3fc270 |
|
BLAKE2b-256 | cc862cdc947506922386b354568459cef6594a0685265ffe5399f7ddf1ec7522 |
File details
Details for the file desktop_app-0.2.8-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 23.2 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6be2f3e2044a2a9b7b0a49dae1b85f3d37f4d34f2b8e8657cd0b32019d4516d |
|
MD5 | bbd2f752aa7710f07304e50f85418550 |
|
BLAKE2b-256 | 6d621738b836ad4c3f2b2acf2eca5ddd6c153e7283b87a53e4101861a3b17399 |
File details
Details for the file desktop_app-0.2.8-cp36-cp36m-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp36-cp36m-win32.whl
- Upload date:
- Size: 22.7 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a395ee9dbc580f8589f532ee638c0fbc766ff8c242b647b9f5b360315aeb019 |
|
MD5 | fa77536e41e721dd8f3aeea9d0da48c6 |
|
BLAKE2b-256 | 3eaf18574ac79ee3cec9141fa237eb22e15401c116a9cc43020c29bcdefe5e9f |
File details
Details for the file desktop_app-0.2.8-cp36-cp36m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 38.7 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025f0e715c666507a398f9c3be82b096ad8655cdaf46a9769c8abd754f3d9880 |
|
MD5 | a0c566bd569b021ec779fac9d52b438f |
|
BLAKE2b-256 | 17cffb573a7a0cf29e06fe5c85f72d5080558917b171108e7d241b3eff1468e2 |
File details
Details for the file desktop_app-0.2.8-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 38.7 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce9009759878c0cdb84799288b7517ab3fa055cca113d781abff9e37442c82c6 |
|
MD5 | 59f2f843324f2215ff3d5796eb503812 |
|
BLAKE2b-256 | 6e6795d5ac7c290069b45c729a55013dba4ad107acc784281fbfaf5159f2af8e |
File details
Details for the file desktop_app-0.2.8-cp36-cp36m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.8-cp36-cp36m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 18.8 kB
- Tags: CPython 3.6m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e179fb23a005eeb73b6b82e0174b21906cb8592ad5e6253b08f02f7f49a2b5bd |
|
MD5 | 2747bc47db87b487f986ec23c0ab1068 |
|
BLAKE2b-256 | 80d93fc9a687220d8d2add624ea1edc3f2874dfffb56e5ba741c1d24d194260c |