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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.8 Windows x86-64

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

Uploaded CPython 3.8 Windows x86

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

Uploaded CPython 3.8

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

Uploaded CPython 3.7m Windows x86-64

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

Uploaded CPython 3.7m Windows x86

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

Uploaded CPython 3.7m

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

Uploaded CPython 3.6m Windows x86-64

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

Uploaded CPython 3.6m Windows x86

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

Uploaded CPython 3.6m

desktop_app-0.2.2-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.2.tar.gz.

File metadata

  • Download URL: desktop-app-0.2.2.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.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.2.tar.gz
Algorithm Hash digest
SHA256 08cc9046510fd47889d58ce9b39ee7db57782c1264f533083759a14b8d14d610
MD5 f2d020b4b4aafa7c6acf37d086fd687d
BLAKE2b-256 8d55c15e4f4225deb47f49e95a26a760553ee5af63500533899dcb3a51856642

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 592e6b7482c8f242bbc0e10bf8b843cb061a87300824b00882ce659890f8ce21
MD5 a39281aa3793714546a913ddde40c2f0
BLAKE2b-256 23b28e4391bb996cef0ffab19571ada28787d03189cde95da1d6314b4b1674bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 4692db667dccd6929fa8591628fcab25e1019cf743d5a2b7c260df8419aee7fb
MD5 2503bf1843d28e8825f52a79eeeb3d4a
BLAKE2b-256 680bbb3dee2f1c0ff499c12c5b9bc974ceb0a783c29e287b9f7aed7a0664e75c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 91a48d7931690e68d792733bcca73a66562ff7427ed443cd561f2dd6432061c2
MD5 be448012ebd60c581f4d9ab3e75687a8
BLAKE2b-256 ab5d40fef00a5e653c99b43e172116aa6f4381baa502ad99a094d5de7c76fc08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 43a5e420eb3de73864215a5d352739d656a86c7acd2089f9b20f0c01e69735f2
MD5 cb078e57472f5af5ef7f5c99f32085f8
BLAKE2b-256 ebd5b4c1d7177d6382baf4238221cfa61b08f7f950ab2edc48bbe5f33d1cb931

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 7c8e20fd430f55ce78486694f7f0909bf9f94c68c4318e2b4b3e0288300247f4
MD5 f095f5597c43b72f03299e8179a45be5
BLAKE2b-256 2c41abfda98def62ebc8719c6ff28fec9b13c9d5b5b195e452e8846924d3882e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c712ae8a5e1d3a13ff124e155d86b43865ae74cf3b444c30f8524a0a5968373d
MD5 9a16989efbd435cc1c888fbc5ecf55dd
BLAKE2b-256 ff16b85515f5d691971feae3ac697918e62914cfd8486103304632d8ca101d28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 1197974789b1a28fa823bac365cbc443e432fb7fe7ddee4afd99466df9803a5b
MD5 46e5837aef5e36bef912faeb2c5bf7c8
BLAKE2b-256 d69130279afbc04ebc364af3b43316368e04da60fa99587f10b7c873d17680b2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6df954ebc03a2d35ceb8e67dd73b5f5862044d832fb7e43df1315cd0f1547814
MD5 228dfd89e7e3dd2e81e57f9bb78e8695
BLAKE2b-256 ace370725279f6ff005e5d9ee74cecb9686ab77089e80925d33457f787e47e39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b8239959497e59112501669a2f9f6bf24e0a3f0b5455e5a2dcac96d597c4b64d
MD5 2417e31c03554399c32b5e798b6aedfe
BLAKE2b-256 036b56846ce2d46b5a32199ef40e9e23f0a143f7c09a760d1cf65bea3851cefa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 666e890affe49a77a86c3b4420f397ad68562f5e421fb9ac13be340b22dffc40
MD5 3c6a8f6d8795de3f665c198bd883bc9d
BLAKE2b-256 2ea5089310e62e21c64d3192e5d0cd610d6469632b9acc658920cda77dd1dfd6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c315b52d2fb017e48b418cf9ae6fec3c4e553d18ce7ae62d398ea1c4509f9aaa
MD5 1f003cb61c40e879622425fa28b5ed17
BLAKE2b-256 23972930407ee4db08fb7dc49ffed8631776e649a079306dd09aa45f3b598222

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 0735079be7ced942cc253fb9806eb963db4bf70ba1763bb01031f8d3a2ca6342
MD5 aec7ba7d0fe4af772cd606e819545860
BLAKE2b-256 1b92d99945a8bb8b75a36ad82b68351d3168bc08a4c27d3c0b2498b758e83e2b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 be207ea1289300197e82ccadc3e725064a0ccb258a4cf5b556ac1af04343e084
MD5 0b96bf9d3185d463cee5521c641ba474
BLAKE2b-256 97740a5dc46fdac32699e2fbc59d8e29faf3e5c880b8956e00f63b763277f1ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 099b2d9984c3318eb803318a61a5bb7eedb561245415c6adf77db40d85b81f9b
MD5 deb74178065be4f4e9798c7ae07c4bcf
BLAKE2b-256 2d6190a34b81e3b7a1fe0d41e8bccae3e35d4542502e51ae7b1eb8b38f264019

See more details on using hashes here.

File details

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

File metadata

  • Download URL: desktop_app-0.2.2-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.2-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3f0a8bcf0b4deff68dab95732c3bf9acff9c48fc5576fa3b5ff41e089f6d6874
MD5 378f8aa51551f08504c5fcf4752ee4e0
BLAKE2b-256 33077eca0ec1aa802cb9a08c0cacaa3018801ad0916145e7ef46d105818b48ab

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