Skip to main content

An easy-to-use Python library for displaying Windows 10 Toast Notifications. Improved version of win10toast and win10toast-persist to include callback_on_click to run a function on notification click, for example to open a URL.

Project description

win10toast-click

An easy-to-use Python library for displaying Windows 10 Toast Notifications. Improved version of win10toast and win10toast-persist to include callback_on_click to run a function on notification click, for example to open a URL.

Context

1: Original module.

2: Tweaked version with support for notifications that persist in the notification center.

This fork is an improved version of 2 ^ with callback_on_click that allows to run a function on notification click, for example to open a URL.

Installation

pip install win10toast-click

Example

# modules
import webbrowser
from win10toast_click import ToastNotifier 

# function 
page_url = 'http://example.com/'

def open_url():
    try: 
        webbrowser.open_new(page_url)
        print('Opening URL...')  
    except: 
        print('Failed to open URL. Unsupported variable type.')

# initialize 
toaster = ToastNotifier()

# showcase
toaster.show_toast(
    "Example two", # title
    "Click to open URL! >>", # message 
    icon_path=None, # 'icon_path' 
    duration=5, # for how many seconds toast should be visible; None = leave notification in Notification Center
    threaded=True, # True = run other code in parallel; False = code execution will wait till notification disappears 
    callback_on_click=open_url # click notification to run function 
    )

Release History

  • 0.1.2: Prepared for distribution on Python Package Index (PyPI).
  • 0.1.1: Renamed repo.
  • 0.1: Initial release.

Versioning

Using SemVer.

License

GNU General Public License v3.

Acknowledgements

Original modules

Stack Overflow

Packaging & distribution

Icon

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

win10toast_click-0.1.2-py2.py3-none-any.whl (40.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file win10toast_click-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: win10toast_click-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 40.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.4

File hashes

Hashes for win10toast_click-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f534ce5d03a55d8e7d8665abc99e1839825423cf2d968b526b5507efce512ebe
MD5 b2860b97d35ef5977d6637e8c7ab2626
BLAKE2b-256 16cb0f5d27b9b67ae9cf0e3d559582a3dce368410c432908a15f7bf9e01754b6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page