Skip to content

Instantly share code, notes, and snippets.

@htlin222
Last active August 25, 2023 20:06
Show Gist options
  • Save htlin222/0dbed84f79b54717d2218de8b9b3fcf4 to your computer and use it in GitHub Desktop.
Save htlin222/0dbed84f79b54717d2218de8b9b3fcf4 to your computer and use it in GitHub Desktop.
This code displays a notification with the message "Hello, world!" using the OS X notification system.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# title: pytest
# date: "2023-08-26"
# author: Hsieh-Ting Lin, the Lizard 🦎
title = "Hellow"
body = "🦎"
def run_macos_notification(title, body):
command = (
f'osascript -e \'display notification with title "{title}" subtitle "{body}"\''
)
subprocess.run(command, shell=True)
run_macos_notification(title, body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment