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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

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

Uploaded CPython 3.8

desktop_app-0.2.6-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.6-cp37-cp37m-win_amd64.whl (23.1 kB view details)

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

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

Uploaded CPython 3.7m

desktop_app-0.2.6-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.6-cp36-cp36m-win_amd64.whl (23.1 kB view details)

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

desktop_app-0.2.6-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.6.tar.gz.

File metadata

  • Download URL: desktop-app-0.2.6.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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop-app-0.2.6.tar.gz
Algorithm Hash digest
SHA256 4ff60a41d44bc852072d8fe6417f74e42d434eb4bfb80072e2d35a342128f7ce
MD5 f85965b638aeccf9a062aeb0f276d391
BLAKE2b-256 d3fbd63bf82bc1b69c02b9b514928ca006288c1700db99ccd658b777b835ece9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4e2a638edb9db49cddf262b0d7dc118b1ae32ecb400ad734adeb2df422f30856
MD5 24401395e57934088009014abec55f6e
BLAKE2b-256 51c3aafe82bc352999b39aa69a1ffb4bf5dc6266b9420df1fe4f5b1ed5286e4e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 79a49213974cd2c2f0d9d451b2022eaea910123c87c9c6971fb9082aac6385ab
MD5 cca3540757956958b72110f5dc4e6cd2
BLAKE2b-256 a10d80bcb68ab0615f13af830713afcb1d8bf13095912b0138b925728c2d115b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 534e742ea7a43b17c8d4a8100ec954939faa4b077977e0fea1cdb757dbca60f4
MD5 2710783521dd0c2f0608b4abd8fe74bd
BLAKE2b-256 0b28dbbedd97aeb8dfb2a3e690cdff79eab2c9b4fba716ea89953633b6020c0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7b287dd31de6c3c98fafe6b4c91054899e54fcbcd43d86dfd3a17da427783388
MD5 ff355ffe7891f7231e62e268aae397a9
BLAKE2b-256 d71b5190298e6e91bbd701b869338955899cda1004a5ce284c4503bb780f78dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 cbb7f2347da627267b2c74eaf0b5915bc299102225251be6eba801cb36eac818
MD5 1464da5b7400abb8253f9c45c9008cfc
BLAKE2b-256 a21f74ef48951264d6dc2649655c577209d1039e82a786f0958c0e0fe78863f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 68f2882aa9a49094b680c31914f9866cb6c7f7a516516a2c6db7cdda172e350c
MD5 f63be2c643b6917f80c1d92fd25472eb
BLAKE2b-256 36f0a0ada8e3b71860fd7fd81d17315ee2cbf80ded64521b10a8c3a0f01cfd77

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 7f47a0ee73699e9f207847211e3c9299bf2ceb18a2509330df45ecc95504b976
MD5 78ac546c0aeecc6dc744eae59c3aaee8
BLAKE2b-256 4cb78517ccfaa6c8535f172efa805da6c3bfb947ba2b6791549c1823f80b7ea6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 b05b298b75f0ee6431a4bc816095a4364bd732ddf7cd049410698181ec68b677
MD5 0a825b76232f3e90052ac57cc764aac1
BLAKE2b-256 cb15e8633d4bc4d7aaf87639ef119bfd941194f21adf88dc6604b49808c45613

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 815c4aafc604d06fff437efd3e0c62842852b6ef74b11f5174fd95038a758573
MD5 982782cd7149039990f0f0d0edef39fe
BLAKE2b-256 60e489daff377ad564608441db66d37a94f9bca805d2eafa33ee6a3d0571c40c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4390f4bf7b887f270fff0600d0ae5e3f056a6079ea3be5adc071f6b0eebe6419
MD5 a3967cd664acf5d3585069b8d060e6d4
BLAKE2b-256 52ab265472c6696ea90de3bbdd77ea4ebef020340b94cd259f427cfd71974f42

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 e01db38a4720319f15b05fbb41a820a7f42c1d063d6775be96a52cf10b093415
MD5 46d068d3f34b2cdebe06f2e2362170c7
BLAKE2b-256 15136e7b77bb77b76e5307766451c974cb9977b1c61742ad5459c1e6606560e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 dc45c57e5149bcdb43fdce0346c9b62b8a6919968dffa8ba2be3a40f3c3fa7c7
MD5 54f87549577547bd7e35f9a19025127b
BLAKE2b-256 0f4c9dfe942405f81d3b9485031cf70ba0e70b5efbc6fd6417e29af11da612f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8be15b5a79422105d048323b3c5fd8008792c8a10384cf16b9677fe7801501a4
MD5 a193a432a6146a8864eae182c4fef3af
BLAKE2b-256 917c1384a2f6a2b4e7daa0744861d10b74e2064b2108c6ed4de5ed8a9bf98231

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8109c6d491446a33f13c2f5be12b5e97989ed181b6c327752639c3a5e99195cf
MD5 76b5f2417126b8c80a49408f5ec8b51c
BLAKE2b-256 5ea245a5f1a203c950f41b47cc2fcef50c769c13073b40f78ddea21598ece612

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.6-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.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for desktop_app-0.2.6-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 2a8403c97c379cff9e296027941095ac608a376b72b299a49de90a62dfc0c6bd
MD5 880f3ffda6fe492d6a8509f57403f411
BLAKE2b-256 bc7c567278f6abcc7c6d83390c049a0767a3fa6ea76a9598fa3b5dc4db7f9dd1

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