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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

desktop_app-0.2.5-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.5-cp37-cp37m-manylinux1_x86_64.whl (39.9 kB view details)

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

desktop_app-0.2.5-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.5.tar.gz.

File metadata

  • Download URL: desktop-app-0.2.5.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.1 CPython/3.8.3

File hashes

Hashes for desktop-app-0.2.5.tar.gz
Algorithm Hash digest
SHA256 82ce84d31ce74ff20c63f54011bed1335dd539c56848058d762752a0c310423f
MD5 5fd7052d6b8bc1c41733648c4b8f389c
BLAKE2b-256 c93d606f4833c2a95b2fa56299975aa1bf9e4e558a5f9a5991b53ab6728d3a59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d4cfb0200649a23daa5cb98fc1d94f31f2b3538a17b202b22161de1451d3b413
MD5 be37ba610aac35f041497011e4924efa
BLAKE2b-256 bbea881c4a1a9d42bc7c64d2fc76a3f3f1141aaf59cdf8ac4e288f803edc3f21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 f7940fb1c0e8d534e8dada4da8b3aa1a7f4a6297531915930e37ae9a44091ce7
MD5 90403cbaac010fcd2c7afc1eeed1d352
BLAKE2b-256 f8f4547bfcb01131ef170d722dd8d76a0235aead0e172b984d31b5aa921b1a32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cdf0ac1e9be316c8a748e80f373a5e295f16d68133173edb16631505ad707ef4
MD5 e056d8cfba09558440e28a9b717e1aa1
BLAKE2b-256 fe41dc4f9059cdf564d2958cf5a75e4a7646420d6e49e45e2a04ee17be0a7a19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 889857044a0900e56f0469827f2f5ccb968757cf46448dc36a895ed9ef7a5978
MD5 fd5abb716d096961511c2c698011bf88
BLAKE2b-256 646634da4ca6da309b6143410a801788c3e355c092ded53e486503c872b9916f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4bdec04fbbea15d90f63d11326c432d170d2cfd493fccfa7ff32ac7302d70b75
MD5 d85a37abf3c9a2b2bdbc3b9275e754af
BLAKE2b-256 ef31f752d41f4d063e788961c06996e932522250782b1f8e1bb4ad90ff1840c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 998494de15e4881543ebe4ca77368060184d46bf63230721091a510dfd9f61d8
MD5 c3f35164d5e60ab0a95392f56926560d
BLAKE2b-256 4d12096f47c3cf0c598777acbfaa9d67083fb5d4454cae8a9b373d4df737728f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 5ba7df2ff84e42b08e3ec61fdf88ddf26cc1a4b17b32e72c37ee9cd06ae22161
MD5 e93d88b316cfff1050adf5c51d67940d
BLAKE2b-256 bc855ae363629ebd9e12ede3e00b76827a771affcaaeb9dccc1c5ba0eaddc115

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e24431bdb2d6c2bc990e95f15a36c372cfbf8bfc22425a277b4d38499a5939a5
MD5 f06d9d6c95b5b112a107ba822ca5a295
BLAKE2b-256 509299420f172af8a451ca3cf93689a3ef8a64573abaf120d760a7514736419e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 39.9 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.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fafc2be66614a95b27274cb6cce197d3592e7a67c9b9fc2f891e93d9e0318eb6
MD5 c708020fcce111e02809b47f032ab678
BLAKE2b-256 64b09f4fe636135bacbbf68f528c747af2b443ce63c47a61998a7fcf96a201b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8f86868c7548f0794fcbe05c8cdf94065831e2d5d52ac665e680b4449f9fce16
MD5 b9e8461b373d2b80e6aa8354371f91b3
BLAKE2b-256 a0c7e13b0efa7f816cbfb60cd2ce350037004c2de17dca6e49fbc1ea71ef9fd7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 cc6cc7274c40a36b80366801fbce6d727184f2c113bab2f3394d598972742ade
MD5 572a1cc9f48623a3ff6fc50a2950347e
BLAKE2b-256 3b0644e8fd8f6a085a668748dc02c12033aa8940271746cf50b9b4edc53fdd3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 4b8376698d688511f2939bd0517e1440507a889e96b87c205c159e9fba7ecc9f
MD5 bc11399af27daa8fdd77b83e49e5cc49
BLAKE2b-256 7eb06948ed1cdfbfbc7a77efd7bf0dc15ed4180b34a12319479a5556bf2e8c1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 fab5ed2b3030854fa396f2fe55deb644315e708bd37dfd10b88162edb21f1c23
MD5 a4f54283f68fb7ea34b6f23a2a97c6f5
BLAKE2b-256 f458fa498ce865ab48002f7fdf89c657b94b0687ae3b8b5a6bbe5d3e4b641c9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e0ffa2a94b5f6c196a94b0b0ebfef7b9384a39c80130b7d93c39c853070543e2
MD5 e5d0dd2660c3fa495a45a5e03835d321
BLAKE2b-256 44d8e062e9a4366389de2bc86bccd746a847c262dd3bd8d9ae1601dcef0c2a48

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.5-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.5-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f4616da8b45df1ae875bd4c1cd11e649290f3518ff7ca151ab169e15779f4d53
MD5 b6c3d68bc7d6c779baff5cecf2fb07db
BLAKE2b-256 067463695409f3ed4cad5dbec01e7f15c92297dfe99d7af1e77ac33ee65a6d64

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