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.7.tar.gz
.
File metadata
- Download URL: desktop-app-0.2.7.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 | 9e4de0ccf6c490f8a3958366d763565d3a05b89083c776284ac9916d7edc7be5 |
|
MD5 | a3108dadf53cafa23938dd05ac655fc4 |
|
BLAKE2b-256 | ddbc033f89b87a248c1cab83a844385f08af9e2ce68462d59b479ba13d158508 |
File details
Details for the file desktop_app-0.2.7-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 1f0f1c39a6ac3b7f3a14590f3568ef6b47e3f7bfa89c28046f6a366c840578c3 |
|
MD5 | c76478b081b1d7b97eef26dac4da5671 |
|
BLAKE2b-256 | b79c6bee86b174dce82bb089a5b5e82bfdd1a316afc57704f88f55cac2dff917 |
File details
Details for the file desktop_app-0.2.7-cp39-cp39-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 802215691df5a5ef72d27eb3b500ff90fda94e375409ded772be145feffd8f17 |
|
MD5 | fba40554179d013bea4326776659003a |
|
BLAKE2b-256 | a1d2135541b4b3cbe60de96dd95e4567498ba4ae1a68337a35dbe00c9f6a3213 |
File details
Details for the file desktop_app-0.2.7-cp39-cp39-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 9b0b0f1f6f606fb840ca403b052f1b2798abb94b5311873aac077baec0a4b0af |
|
MD5 | dbfd8bc7e0e849e89f7212d8a5686bfd |
|
BLAKE2b-256 | ccc5ce5914cd39ab3b751898c97f19690b803bd2371a27f6b833ef72f130b053 |
File details
Details for the file desktop_app-0.2.7-cp39-cp39-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | f613c4931a5fa1baec0a3bbf34c3cc6ac62b1bb6a96a21a91bd461352b8aabe4 |
|
MD5 | fc3fbe43474464d0cc8336365cd5161f |
|
BLAKE2b-256 | ad8e18e918e70032a19472c9fcf6a66ef28cde80001d4a3be3c713677bb89bea |
File details
Details for the file desktop_app-0.2.7-cp39-cp39-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 45e66d5203968c30b9bbef69f536ee0d4390fad6267ac19fc8b48936490241b3 |
|
MD5 | dc49985f64399632fcf5fd324bd28556 |
|
BLAKE2b-256 | 112ce3d0362a833f6e17738ced4421c4abe12eb095cde1a42624f45a63936c58 |
File details
Details for the file desktop_app-0.2.7-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 23.2 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 | 595c30d193a650c4f0f7cca64941b74853f270d09d35ba13e35aaf6b48f39deb |
|
MD5 | 9e57e04ed457a03d8ec07f8c50c2e0fc |
|
BLAKE2b-256 | 8930b2bd9c90d46f6d868c99cf495f7544999dd7a536e0a70249492b54fd091d |
File details
Details for the file desktop_app-0.2.7-cp38-cp38-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.7-cp38-cp38-win32.whl
- Upload date:
- Size: 22.7 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 | 0ee83eba24cafccfd366f0341fa3d2132e4452a961b9a50f2935f5fa45e4bf5a |
|
MD5 | aa5a264dc283e2e627043732d23fab79 |
|
BLAKE2b-256 | 53888db69203e8579722da512f12094451c7cd6857723d8110f20243da1e3f8d |
File details
Details for the file desktop_app-0.2.7-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 5a62795e47d26203d435ffb492d60478303d2f8c278473e1155f8439e0613baa |
|
MD5 | 9e9302bd84308a53c896030486275d06 |
|
BLAKE2b-256 | 16767ebd88f6b097745a9b584549584dc6c33859625e24c4d20b8390aca40bf1 |
File details
Details for the file desktop_app-0.2.7-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 4e4e42c1c9a9a1dc23639adbb72ce7113a3790a18bac137913a144a318d8a126 |
|
MD5 | b6f132da1b6356c27a4877bcfe45d5be |
|
BLAKE2b-256 | 8c67eb6832992dc388119eb8b1e8c20c7fe22f00aa79c5ede83dc9977c843df6 |
File details
Details for the file desktop_app-0.2.7-cp38-cp38-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 6dadb4a319db147c426727f43422eceec95577b9be64739755be4d2f19f039f8 |
|
MD5 | 8b1102f80509fe0edee19c282502f470 |
|
BLAKE2b-256 | 046977a9dc397cbb4555120f01b4c90c15bebec692692bb13ecdf61cb06e5783 |
File details
Details for the file desktop_app-0.2.7-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | e5f92899e3b39962c39af49d13ed63f6d8b6eaed9ce9d7e51ba47284baae61f9 |
|
MD5 | 777e2b4e27ae30dc8e5f8381193a2227 |
|
BLAKE2b-256 | e8df4f8e8bc312d37d2884c27a2e11f4ef44f7e897864ae8eb9e3b356ecfe9d2 |
File details
Details for the file desktop_app-0.2.7-cp37-cp37m-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | a94cc914f372d090aaa8e4ee78b9a64fb66faf9a2b0d61ab037ed216a2207776 |
|
MD5 | 378ccfffaa953ce89dd506c7f6307c57 |
|
BLAKE2b-256 | 31c0a457bd7aae2bcc847b28b954120a3112352ab8e09db7aff0070d2d25f142 |
File details
Details for the file desktop_app-0.2.7-cp37-cp37m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | da4d1e5488977c42eb669a607341ad9a84b2fd1bd048afddeba6116399a312e7 |
|
MD5 | 91a630f7a748042b69d4d5e09ce6c833 |
|
BLAKE2b-256 | b9c2f3d645b0a60ac3af56225b54e3ff2922c76a3475a3a792d15c549857f8fa |
File details
Details for the file desktop_app-0.2.7-cp37-cp37m-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 39.8 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 | 72cec0439721a8a6c054b70c38bdcbfa2409ecccc1a4466edcfcc89a7b5f366e |
|
MD5 | 1d2cff18b0350f8638c46c171e35ba77 |
|
BLAKE2b-256 | c97c4e3028cd3cabd90e1df8a3ff098a3bf6078c67b4f62b54911bb83817102c |
File details
Details for the file desktop_app-0.2.7-cp37-cp37m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 09a811cf03b9b6b3c69c0c50f598c214eb5ec09c3562facaeb52341ca9fb1d69 |
|
MD5 | 6eac041a0a688feb2976722b0d79dfa7 |
|
BLAKE2b-256 | e850253f44416008961f937f075dad010780c3d0fe2d234cb49c32bdea410519 |
File details
Details for the file desktop_app-0.2.7-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | 99eb2de0bd000dd574c4b93abac584e431210a0e0a228c9b82ced4152d51d1fb |
|
MD5 | 997f61b2c3f92a0964a397f25e7de9c0 |
|
BLAKE2b-256 | c7f3156520920c5a4fed1f0d2691a3d86816b4c5efe5afd44c58dfcdff7fe482 |
File details
Details for the file desktop_app-0.2.7-cp36-cp36m-win32.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | f8266917a57a3547028f8e4cad7a231a939944935d28dbb42d88c74a3a1cc54f |
|
MD5 | fe973e8f53c5fb095579e4d74d30d27e |
|
BLAKE2b-256 | da131d720913d3ca0cbcfe13a6dffb06376a1e4fa3f6660ce9b017718a4decda |
File details
Details for the file desktop_app-0.2.7-cp36-cp36m-manylinux2010_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-cp36-cp36m-manylinux2010_x86_64.whl
- Upload date:
- Size: 38.6 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 | 549203c2d6cbc3cb90ccd2d5477d261d6281a59eb38bd530a78f4b54f49602bc |
|
MD5 | dc10047e661f83249e75b1f246b4dd8a |
|
BLAKE2b-256 | 907ab1c705beedbdffb8dd2ceeee1340997a479754e6c7fc918775689fedb653 |
File details
Details for the file desktop_app-0.2.7-cp36-cp36m-manylinux1_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 38.6 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 | 370c1bd54947c19436f213066aa6ef474f2379b135fd38d853dc0a9ba7cad4d8 |
|
MD5 | e53c6dac89700d99447e5ce060fa38d6 |
|
BLAKE2b-256 | 11f4c9b3b316908bf146415ad751f634d6adc74ca2bab3ea80e029dbe63aeb2b |
File details
Details for the file desktop_app-0.2.7-cp36-cp36m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: desktop_app-0.2.7-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 | b561d206b3c2cf743acf3bcfda9a359266bf21258dc516ee9b5b906d25d71c0d |
|
MD5 | 221767c9857e109d2fc31a6be5247cf3 |
|
BLAKE2b-256 | 5fa95e665d25d724cbdbf9f26c0ae969d563390b347319bafdaca3f6252babb5 |