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

Uploaded Source

Built Distributions

desktop_app-0.2.0-cp38-cp38-win_amd64.whl (23.1 kB view details)

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

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

Uploaded CPython 3.8

desktop_app-0.2.0-cp38-cp38-macosx_10_14_x86_64.whl (18.6 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

desktop_app-0.2.0-cp37-cp37m-win_amd64.whl (23.1 kB view details)

Uploaded CPython 3.7m Windows x86-64

desktop_app-0.2.0-cp37-cp37m-win32.whl (22.6 kB view details)

Uploaded CPython 3.7m Windows x86

desktop_app-0.2.0-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.0-cp37-cp37m-manylinux1_x86_64.whl (39.8 kB view details)

Uploaded CPython 3.7m

desktop_app-0.2.0-cp37-cp37m-macosx_10_14_x86_64.whl (18.6 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

desktop_app-0.2.0-cp36-cp36m-win_amd64.whl (23.1 kB view details)

Uploaded CPython 3.6m Windows x86-64

desktop_app-0.2.0-cp36-cp36m-win32.whl (22.6 kB view details)

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

desktop_app-0.2.0-cp36-cp36m-macosx_10_14_x86_64.whl (18.6 kB view details)

Uploaded CPython 3.6m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: desktop-app-0.2.0.tar.gz
  • Upload date:
  • Size: 56.4 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.0.tar.gz
Algorithm Hash digest
SHA256 1e4547f0a173053e1090b390cd2c3a02c2647e819433d20e848fb75fe261214f
MD5 166c58535fcd8b5d4c2155bcb6d1298a
BLAKE2b-256 82f3d3a816da0585bfd8b87e1dab3cb411c52340f421dd97aec24862ce70e991

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 23.1 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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3a19cdc934bb53dee61fd6534f0775ce999a85d171435da74848532775f8ae29
MD5 19c4bbc0fa3b8355ecf63b38279c6c7d
BLAKE2b-256 589c036a9c44c7cbb1518b57f04e9728b43621d3f0fa33a6b7bf010f6d6438e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-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.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 ed8d3bcc72ab786d3fb74f0f649b708b295b61944842ebd6a33f391210a28c8d
MD5 be4e026b681808b6d6e0327f6d88d313
BLAKE2b-256 6d936ffb8d43502e3bcfbc5551830f5e283c8cccdf83bd992131076b071f5d63

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-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.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 647bf29748c2549a3c978a2da793c2afc56b2c69b2449abdb0e96cd5758d505e
MD5 9e24fa91c342c6a0511094fc8c951331
BLAKE2b-256 5d52f01a051cdf5eda6b1e135dc206646ad15b5ebe4f5177efce65efde6fc19f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-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.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7eef17953e158da919bb6161e387877bcd938fdc108db5bd954e2c8094bd13d3
MD5 addcc97ff464c0077f370472a7f8e904
BLAKE2b-256 ce9ffb67d6169cda1267a75115ca215ff701ae42bfbaf4f261fca0bc726e817e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 18.6 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.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f9cb6890790fde9ac8f1ec5f5164d52e324308fd5cfd6ace24916189d9928437
MD5 6da242b110046b0250c9a7c2cf911ecc
BLAKE2b-256 8fa92b4d5d7f9df179728c92bb5d76f1f737d25075ad9ac017c52e5503ebe4d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 23.1 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.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a1be8413f647a1d2714e647b875fdb8e490290b9f81ed7e8f9078edfb8d3bf1d
MD5 a371fd0a15b2b666910662523fd1189e
BLAKE2b-256 4dbf4aa59d9bdd1abf78f9c32212a5fbe9dea8d73053afb88e7a8e381f223097

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 22.6 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.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 83d20e09500b9353382a19bea6bc0d66ba37f7df98f5bd086d4c17abf498b236
MD5 70b415ad086f52f9350990e1dd74cc38
BLAKE2b-256 b0aeed53a49351fcf1d54bc552c04816b064a019516c8be46e5e9dd76fc6cf47

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-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.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 20f74c7d589367de1cca7f07a8440ed0ebc3eefd148caf65d24d3c969d7c8a3b
MD5 122b9450179644b8aacd2babd9847d64
BLAKE2b-256 81550d0fe6d5386f1c120fc88a698b93f046b56390a586c1f07a7d1e6a064226

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-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.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 f994fb7ec03601c4bf768219450d372668cc65f57cc5c2d5ceb239d76b25eb4f
MD5 a1252cf1b40567b21dd09d1207d20ede
BLAKE2b-256 514a4fba4d966c081ad0e126c725b355cc0d40aeb917474e23bf63c494ba35eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 18.6 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.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 201cf43accb697fc8c8b08d783e21679e9d3dfdf5df7ebd5b0bfdc5462fc01ab
MD5 7fff24504d96a3dabc698139848c8640
BLAKE2b-256 e4d6150068e9d19e32eb34cc9ada99f6d521bce7810bc761d2320ca3669d8e43

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 23.1 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.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 fe241d1765bf04ced3ba5f2c05faa0a4ff676ce5f6115c263a3a9d3dc45b5de3
MD5 b6c1c2c129cc095cae710ee1dace3098
BLAKE2b-256 c85844a587ca363ce5cf130e9e2631d1341760062d17053bcbbb215344b187b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 22.6 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.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 73373ca4f61a0d3d13fc6f024c0fa23f675a0da683a253839c0011285a9a0941
MD5 d489dee9a2938f9d54ade094ca99093a
BLAKE2b-256 9461d370e9ff799daf1f7af336300105a6af4fd92889eec10172b4f1b7a1a95c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-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.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 75f097c3393acd80a801b6fe317975363ac725cfc72c1c76cd5a4e4c1ccfdde8
MD5 340d761a045e76e489d4eea0bb27a697
BLAKE2b-256 a9315491c60617be2ae749eabc5b620f6451dbf257f5bbbea165fa33c54d3407

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-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.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1056cb073f01463f98f79419387606d047ad73c4765436c460126bcecd88eaa5
MD5 ecfe0f79d7c6f69b23825243afbf78f6
BLAKE2b-256 9b8b79ba00bcb93a932bf6ecadc56eb6e54a32f6e1512e61256e749a73a922ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.0-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 18.6 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.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 78f139150129a41d3a91098b6edb8d1e4ab196c4fae11476fed4fa4002c0e940
MD5 8508fba70880df8e2e2629b2af01e4e7
BLAKE2b-256 4154085d7be3b984e81874182833f696c32c10c84aa8a30be22ad77216b903be

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