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.3.tar.gz (56.6 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

desktop_app-0.2.3-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.3-cp38-cp38-manylinux1_x86_64.whl (38.7 kB view details)

Uploaded CPython 3.8

desktop_app-0.2.3-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.3-cp37-cp37m-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

desktop_app-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl (39.8 kB view details)

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

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

Uploaded CPython 3.7m

desktop_app-0.2.3-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.3-cp36-cp36m-win_amd64.whl (23.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

desktop_app-0.2.3-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.3-cp36-cp36m-manylinux1_x86_64.whl (38.6 kB view details)

Uploaded CPython 3.6m

desktop_app-0.2.3-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.3.tar.gz.

File metadata

  • Download URL: desktop-app-0.2.3.tar.gz
  • Upload date:
  • Size: 56.6 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.0 CPython/3.7.7

File hashes

Hashes for desktop-app-0.2.3.tar.gz
Algorithm Hash digest
SHA256 217c010222cf3f36f57c95e89804ce5c08b53a14750e858556279ccde339ff43
MD5 50e2b9ee042730bc25895892df4e6a08
BLAKE2b-256 88e329826d141df46a9f3a5db8093e6079cdd577d8c30d2b839525c04711892a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 04049b5376e5bb56e03afcee56573e95213f5a1b1eb36ef76a93a977d0e96462
MD5 1e612516823fd7079d8c2198dc681f08
BLAKE2b-256 30501e8784e9341443620edfb000b57c83f3b8d3f631055af7ba063d57c2cf17

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 94bcb17be5cd53a16bbf80613469e89f17ae15e55f415c83c0fc75bf5e99ce3b
MD5 a8f30c84892d119407024fb1fc893329
BLAKE2b-256 a84c51ed3d195c2348a6289769a187be4e3a5baa88d0218736447497024af37f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 73792ea05808e5b615d97a8a6e06f4a528d6d92c7debdd7d370e4f9fd9b153ca
MD5 9732e1574d2b40f9a9cac3ab42196332
BLAKE2b-256 5e4e748ad47c32b14c628af298adc73c9bb61605d5f61cb444f81900b97b048f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 28d93271484bdb9c6a187b324a2570de94815d539f7f85ffd95f9271cf098d93
MD5 62d53021369753c78bf7bce945a95b70
BLAKE2b-256 b9ff25a21c8f6463bbf98fc7f7421c2100f9df1e4c8055fde1b6ddddc5298aa6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ae6a8f3eeaa63db223b8c2f027ffbaaca9e8ceeaba6f848260b242c5a0fbc102
MD5 f9ad323d48ea4bfe9f3c1db11b03cb0d
BLAKE2b-256 88c709f535b4fc31c02d1b25c1b994d4a85641944f769e53d8c04905cda8be1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 86ba9de4cb007534ca1d256c2a86a848aab2563f200acc590cac8dda9c1d8827
MD5 ad61b308432384689fa35934e5ec6a6d
BLAKE2b-256 fd89d808b48a83b9f5346d5108078b8fcd21eda3420eaa347f0b3b54125a8c21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 ec69f3718fbc8fefa4fba84023c708bdf4f9ac96320e86d8ae716ac9551940e0
MD5 bc0bbebd71a7752ed5b528b94c8fc96a
BLAKE2b-256 5fa252a844d877cee5562984977ae4548fb5fb780281e6c18d871e0b06915a46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 39.8 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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 db76c09fbb50df6492d019f0298f60d8cd1995680def9d59ad71269a6f95560c
MD5 9dce75e58feb5a0f7c74d897c2020362
BLAKE2b-256 de104529ebacfb6aad741613ec6db52103f15650841c6fbd0a5de42fe14bf450

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 35fa5472ee829df0ea75d89bd165baf3a6f9c74ccbaa3d072044a24d3d44a091
MD5 3ce1b843805e67bc3590059d341750e4
BLAKE2b-256 e1446bf7aabfb369a6ea3b8c1708eff747bf88535992fb21a711eeb9f7a6d204

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ae785232c29e996d5f15db7609adfd76e98b58c126df735b66cb81f80c8fa846
MD5 56c0aff0d48605158e742ceb48fc49ef
BLAKE2b-256 9f7dbae77ed26e310188af28250271f1e876706b5cb3b35824d205203c5679d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 81654f25a2970a32c90c50991593054b3299ba316bd6d4bf318b73225478b35b
MD5 918f67c8c4e67bb547fcfdab2de90c8b
BLAKE2b-256 47484963f3d4e4372be5e3a3c9684f1e3e77a24a400ec30baa5ca408cf14c3f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 5340136906beef2fc4ca8d6f1da25d9e5a66f236a0622cd9fde8bd882433471e
MD5 f7badf9810d97e7a5c3468f422cd5b0e
BLAKE2b-256 f83317b426ff5c99579bef2b95c39f4ec2599fe1a1925611b1b7309b4856e52c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 55bc5a1156183f33b4a7d9fa31548da6939adcb94558893dd8ede24dcf70ce9a
MD5 0291781ad7b7b682de082b9f28d5d0d8
BLAKE2b-256 99c1621d6009f446882db97eb4b99849c798cd5fec9f79c3d0c5fe31c7ac9502

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4914f8e79dcd159fd3e1a8566a71d29b5b51d6a5eab6e775c8d2cb5edceffc87
MD5 9464143fdd6705bb0501ffe38852d1e9
BLAKE2b-256 5799d9f2e4135ef23dd65895f371d8d3f11e357d6e96469d15a6374eb23a00ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.3-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.0 CPython/3.7.7

File hashes

Hashes for desktop_app-0.2.3-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 e780ff8a2b2c32bf515a32e2ceb7abc3ced6bbf8955295e313a30c9f5acd6395
MD5 9f4ad83f550f4e4b1be97206788921c0
BLAKE2b-256 7bbdef418114d6e865168a0449730251555689c92e065105f34bfeb2faa0682f

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