Skip to main content

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
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

desktop-app-0.2.4.tar.gz (56.7 kB view details)

Uploaded Source

Built Distributions

desktop_app-0.2.4-cp38-cp38-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

desktop_app-0.2.4-cp38-cp38-win32.whl (22.7 kB view details)

Uploaded CPython 3.8 Windows x86

desktop_app-0.2.4-cp38-cp38-manylinux2010_x86_64.whl (38.7 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

desktop_app-0.2.4-cp38-cp38-manylinux1_x86_64.whl (38.7 kB view details)

Uploaded CPython 3.8

desktop_app-0.2.4-cp38-cp38-macosx_10_14_x86_64.whl (18.7 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

desktop_app-0.2.4-cp37-cp37m-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.7m Windows x86-64

desktop_app-0.2.4-cp37-cp37m-win32.whl (22.7 kB view details)

Uploaded CPython 3.7m Windows x86

desktop_app-0.2.4-cp37-cp37m-manylinux2010_x86_64.whl (39.9 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

desktop_app-0.2.4-cp37-cp37m-manylinux1_x86_64.whl (39.8 kB view details)

Uploaded CPython 3.7m

desktop_app-0.2.4-cp37-cp37m-macosx_10_14_x86_64.whl (18.7 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

desktop_app-0.2.4-cp36-cp36m-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

desktop_app-0.2.4-cp36-cp36m-win32.whl (22.7 kB view details)

Uploaded CPython 3.6m Windows x86

desktop_app-0.2.4-cp36-cp36m-manylinux2010_x86_64.whl (38.6 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

desktop_app-0.2.4-cp36-cp36m-manylinux1_x86_64.whl (38.6 kB view details)

Uploaded CPython 3.6m

desktop_app-0.2.4-cp36-cp36m-macosx_10_14_x86_64.whl (18.7 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

Details for the file desktop-app-0.2.4.tar.gz.

File metadata

  • Download URL: desktop-app-0.2.4.tar.gz
  • Upload date:
  • Size: 56.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop-app-0.2.4.tar.gz
Algorithm Hash digest
SHA256 16492649ca3c3ef9d26881c7c06f71fab5880ebaaffa822e1874c0f2d2a7e51a
MD5 e425709739ad3ed5bc8e44621ed666e7
BLAKE2b-256 e31fd27b59c08016e12b5e5cc12ca1132389163ca5f754982726d4ba0c8a78b0

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 67ed55ac25a4ab760f926ddc3b3034fda85373d6764565fbd2d106a667945cb8
MD5 513c28078f1928388169c808edc4b3c5
BLAKE2b-256 9c5d70beb35c65d99840969d2aa455cfe9c4fb0048f2824caa38cd3097decbc5

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp38-cp38-win32.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 12ac1ba46ff75417566bab2ebcb05d7c68685bbd9c54ee3ca62dea40a2a672d5
MD5 c72c3a3d7f22458da5c7e62cefb63dbf
BLAKE2b-256 aa8d454691d83eddc1ee390f1f9b6c7874abda6da1b8ea9bbcf9464575920bfd

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 62949fe76c8121cf833b92b2ace359a71e6e7339aff8f5c85d86cfc1230d7db4
MD5 86c12e7cf3498591dd3e830cfb5684df
BLAKE2b-256 4e95e925f49f11fc88a9ea6a557ee3e7b6c76349e0203b32ef27be33ad21f01f

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3d85dd4626c3c146e298932ada0a6428b1983f35a6a49606261fccd63ab10992
MD5 e351becbebe2e311740908e17ee0f27a
BLAKE2b-256 be08f205e39ea91af64e31513fcab17f47827094b586e260c4d02e6c2c0bd12f

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8338c0351708703ad688e074ddf717fa5c84d56c503934538ee9923edd90267a
MD5 99a537809941c2667f7a87d39af64ec6
BLAKE2b-256 debd45183fc4fdd28553db875185af7f1a11228c7c928df8735f2a3d07e6c36e

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 65600a4c1d81eebe3f102d674762b5a24523ca525eedacab3208f504eb47014e
MD5 e5b45af86321935e84e438b34027e7f3
BLAKE2b-256 87f3cbb109b76a16b552d242cb19bd5837ab8d8d84c43a0a33de8a83909a94a0

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp37-cp37m-win32.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 2e7f1acc19c71cd562e6cc801cd60a8c659cbd9949534bc516d8531d355f1da0
MD5 4baeb3a4d85f76d47685ba9ab76b74c0
BLAKE2b-256 7bdd232206751536c5f5540f38bb794e0a2772be25e102a9ec04db079be171da

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8211550e304c281da32068a3a2e291eb4a3ed0ebf883d6a9b0bd907d41feb0c5
MD5 e825b411805f98854f07afe72ec0dd59
BLAKE2b-256 1523d0a47be5e58030b958d8effc29dfbfcb2b39c103003bee50375fe8ffba1b

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 82ffb449d6434b31c71edbc0962772f3b17c69d1888bc2d42376fe48cf434aaf
MD5 ec3bbc1c83e93b05ac8cda9cab0d6fca
BLAKE2b-256 35da227fb38e6600ac9fe8c809ae5061753d6ac39c83a536730948385178c727

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 337016ed57895769955eb6cdd3ea7c23a2c67d21f1f12a008aec60042527f6e0
MD5 13d8fb3cbd7e6d22eb8a1011b118a4bc
BLAKE2b-256 257d1205db89c67ad2e050a26418ccd4ff3228f27c056c77117694729f5b6e68

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 9ed0bac8a512f90a4750a053b70d96e01fd138df8d382501ea915fef586ace3c
MD5 803e3a7bf588cc815e0c716cb9f3f40d
BLAKE2b-256 3bb0d9e3aca44363b50990bbbc316876186c006c38c0a81a6549d0d6fcc5b073

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp36-cp36m-win32.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 bc9246b8147683ab421c1db70ef6ce08fa559a195ff9dc2f2d47d58f92449c1a
MD5 46a4959935374c471c0aa70e2cc8b900
BLAKE2b-256 5f8853c404a16a75b2dd2ac8e7bf6022199899a1bdf994a08709b29079268efa

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 405db0d7826881defac890bec50c4487bea6d5484b07c7bf0880c30ea67f9610
MD5 56f046e201a3bd6adbeca2562815811f
BLAKE2b-256 6a8862eeeeaef48df06c0db3a854d2f050b25f911173db8a63ff8d1ca5fad13e

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-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.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 91e75add6ac1527676cd07b79d2211ed1a199b974b54f55ffae959377a4dc5a1
MD5 416f51c547352babc1617509b8e6a79d
BLAKE2b-256 e9dfc8888d35d321f8fb6fa37c572525572ba98f49805c03e117d68979aa4299

See more details on using hashes here.

File details

Details for the file desktop_app-0.2.4-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: desktop_app-0.2.4-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.4-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8dc638eb3b0a40981276543a3cda96e1296bd4d1eb85a9702cfd2a9594e9dc48
MD5 aa0120a33ae513222d8d3964e0b63059
BLAKE2b-256 b0f902078c3acedc092c8dd8147e756ea2c8040eda5b1355d6eb8afcaa2a6321

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page