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

Uploaded Source

Built Distributions

desktop_app-0.4.1-cp311-cp311-win_amd64.whl (23.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

desktop_app-0.4.1-cp311-cp311-win32.whl (23.4 kB view details)

Uploaded CPython 3.11 Windows x86

desktop_app-0.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (35.7 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.5+ x86-64

desktop_app-0.4.1-cp311-cp311-macosx_10_9_universal2.whl (20.9 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

desktop_app-0.4.1-cp310-cp310-win_amd64.whl (23.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

desktop_app-0.4.1-cp310-cp310-win32.whl (23.5 kB view details)

Uploaded CPython 3.10 Windows x86

desktop_app-0.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (34.8 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.5+ x86-64

desktop_app-0.4.1-cp310-cp310-macosx_11_0_x86_64.whl (19.6 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

desktop_app-0.4.1-cp39-cp39-win_amd64.whl (23.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

desktop_app-0.4.1-cp39-cp39-win32.whl (23.4 kB view details)

Uploaded CPython 3.9 Windows x86

desktop_app-0.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (34.6 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.5+ x86-64

desktop_app-0.4.1-cp39-cp39-macosx_11_0_x86_64.whl (19.6 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

desktop_app-0.4.1-cp38-cp38-win_amd64.whl (23.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

desktop_app-0.4.1-cp38-cp38-win32.whl (23.4 kB view details)

Uploaded CPython 3.8 Windows x86

desktop_app-0.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (34.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.5+ x86-64

desktop_app-0.4.1-cp38-cp38-macosx_11_0_x86_64.whl (19.6 kB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

desktop_app-0.4.1-cp37-cp37m-win_amd64.whl (23.9 kB view details)

Uploaded CPython 3.7m Windows x86-64

desktop_app-0.4.1-cp37-cp37m-win32.whl (23.4 kB view details)

Uploaded CPython 3.7m Windows x86

desktop_app-0.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl (35.9 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.5+ x86-64

desktop_app-0.4.1-cp37-cp37m-macosx_11_0_x86_64.whl (19.6 kB view details)

Uploaded CPython 3.7m macOS 11.0+ x86-64

File details

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

File metadata

  • Download URL: desktop-app-0.4.1.tar.gz
  • Upload date:
  • Size: 57.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for desktop-app-0.4.1.tar.gz
Algorithm Hash digest
SHA256 7793e41b2764840d8f55444b320d721d203c0d156305ec36789eb0cc61c9ef20
MD5 43dca0a0850cfec7db5e8e5812fd7913
BLAKE2b-256 5552306696f835b1a5669520a4b933e18d25b3f13d611bb4d85737ca4eedb683

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c045db948910bf5e54b862944dd3153ffc1ef10e1af27c7297f603fd79165f3c
MD5 3dce777e725dca55d935730ad544b541
BLAKE2b-256 fd283d30042f106e3affb54d6949e5a30fe218b475631dfac0bf95e5a38fba5a

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: desktop_app-0.4.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for desktop_app-0.4.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 cfbda36f3e5b8969419bdb0c5f9d964d0f62d921903cdfacd81889a4921a1afc
MD5 0b869ce9629d95390450a62263d77a98
BLAKE2b-256 23b1d9618b3081c2e80245c6fef6a444ea2a3f53be8cd9174b8286c30d0d1204

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 abcf9e48fceb2e1d55a83262ed2ee17177f6d938142c1c532da5e137d9dd39d1
MD5 ca19657de8cf180849772e918cd8ed1b
BLAKE2b-256 8be0f2bfbabf2d425bb9948bb12e45786669b9aded14624128157c738abf5dd4

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8f66fc920ac809d7fcd49f8299b930615624a1a6d55ad128d6e1ebd0feb62fd0
MD5 fb195c71cfa6aecb63e27b2b95e0817b
BLAKE2b-256 82e609c96ae516994723e6ff09ccf2cc1f8e5b172a4ecd69e7f34f74802ee873

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 086819bf41ed55eaf842d30c551599301ec5e9c3f92197adc0efae03eb1230ba
MD5 fd6148b38f7caf2f4f77e54e9433ca37
BLAKE2b-256 223bf5621868ccfa4f1de25d5846cbb6762da1567ce104ba505fb43f44e2dd70

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: desktop_app-0.4.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for desktop_app-0.4.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 40534a956bf34d7250b7c1c5b90de87bb3ae2c26b7bbe38b92728ae239e7af8c
MD5 53d0ac2285d2b0f255b839659e8e98aa
BLAKE2b-256 a31388429ccbe196abe598bc8d7bc5cb3fec9fc0beeb3b893a04c8a9ce429d77

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 4f5d49116b8b8a8b9d2a49450f1ea93d16615ceb5bf8e28dd386088285073bb5
MD5 aa1e1c8d5ae395a0bc0b6fac2f425fc5
BLAKE2b-256 64060ebe4312192467d858981350a11de4f4f473c628f17d63c199ff09380142

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9e4faadafad4b78032930e8259a10898f2bc6068e631a58e6b1fac82eb352ffb
MD5 333b5074f3e7f7d7d048e5ac1d930663
BLAKE2b-256 ddfca303a8cf6d6dca3f284cf57e44bd3f2320a877855b7a54771acec1e71c08

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d80a597374e59d159de59e588df3f24186827c915de9eafb3759d00904efb378
MD5 c47e494af9852238b78aa1da2f93e7cb
BLAKE2b-256 783e258ab9ee4d6e6fdb1ee8638e5efa9c506697cb135dce4027f4058de3c171

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp39-cp39-win32.whl.

File metadata

  • Download URL: desktop_app-0.4.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for desktop_app-0.4.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 1e78c616d2bbc7427d7de163fc6a513ad24576b8e333174a781ff602e856536d
MD5 1cb8b45f75d9ff60fa713f5d5f07b259
BLAKE2b-256 cac40d8a7ddd165ad079af9a530fb3db2ca6d5c4bdf7dc759a59e01b2d0ac689

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 53ac99c96db6c1dad5c980a04c9461d996eeb23743f7eb93dbf7149923036447
MD5 bc24c8aeab7c68729c5b505bf90aabca
BLAKE2b-256 6f1d54326ec3f3ca231fd03010d1b0dfde467f795a49615f2175ce92dbc8100e

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 65ff9d66a19e3bedc309baacc65dca8ba924c115802f0d7cd5ba30e59ab022d0
MD5 d4b2a3649fb0e5e1eebe7e3b4056ae6c
BLAKE2b-256 5b9d0c8a5c80e4c36e260cb2c77f19f8c7ea955ed8ee3dacf6f6eef71071794c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5f5df0c6a1cd48a6380c3f3336192b3e23ba9e14fdc6b4f42a98647c9467aeaa
MD5 e5aa3ac6b34841068cf75e197bab24e0
BLAKE2b-256 eb3427a6141ed983a327e59d555fdb64b06dd9d3d969b467f88a4135d5b2c8b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.4.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for desktop_app-0.4.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 09f4b79659448bb19f2feb88151b4ec6adeccb016af8a6f77251f2f77e34f70f
MD5 d6335d2ff96cbc83b5dcbbade56dc903
BLAKE2b-256 53814e219102ed3688fd8eab0fe6c81c95400fd40d163f8688fa9e0681cb2ad8

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 58e7299606bdb332dcbefa0cc77d38415622bc4e7e2a907100f596296e27b485
MD5 a25c34bc47fc1abb7fdcd299b1f084ec
BLAKE2b-256 13fdc2380d77f5976918bed561106ed40d72d8aab071e2d0edb7b062f2fd9836

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 5da1e08bbdf4f298116fa2191105698e538bb68307d8cae25ecca321cd3d3065
MD5 8ab5884f4822f055aa2a2d16e3aac7e1
BLAKE2b-256 b0583d01816829b725e21c7c04048c62c45da77d0e9fdfca190b25d1f0b4adfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 545555f4332b31a50c3dfc0bfae1c4dbbe7a58494d335aa29c28d7c67c72ff12
MD5 bdd9846b6d4f9d102608d515bb681924
BLAKE2b-256 4bc65a7224eff301b338fafc2804f1e053738a7be4fa0761c75893a2865bc92e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.4.1-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for desktop_app-0.4.1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 67bab224bd1a1d2bb5857c00dfc4510461260be8ce7c07fa632b609bc3d5639a
MD5 b4d2c0b0e05841a9403db78935e0e242
BLAKE2b-256 51cdfced33f2762c73d78be1608309bac65007e0ca0df625460363e677fefcd3

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 eb46a4cf0f61076825546705d0f0e8394526ea31079f24ac4f328485edba1f1b
MD5 c3b8fe24616d0143626843bca608c581
BLAKE2b-256 13b12d6c5e5609d45dfe1bb9ffb9aad672490ff741711d51b4452418178dd28a

See more details on using hashes here.

File details

Details for the file desktop_app-0.4.1-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for desktop_app-0.4.1-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 143a8cf704392737eef7d5fa0c3f0d95b8103935be08ab8732a3916b2c09b68a
MD5 fea4ece24843f75ea8dad588276d323c
BLAKE2b-256 3b8dcb54e19cd523b1b2eda03cefc00ba723d5a218eb3e2a4489348298c657a9

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