Unfortunately, win10toast
cheats and displays old-style, Windows XP notifications, not toasts. A Toast's content is specified using XML and can contain buttons, formatting, images etc.
To display a toast, one has to use WinRT. Luckily, someone wrote a real answer recently, using the Python/WinRT package.
I won't vote to close as duplicate, because the upvoted answers to that question all work with notifications, not toasts. Please go upvote that answer.
The linked answer explains how to install Python/WinRT with :
pip install winrt
Then uses it with surprisingly little code:
import winrt.windows.ui.notifications as notifications
import winrt.windows.data.xml.dom as dom
#create notifier
nManager = notifications.ToastNotificationManager
notifier = nManager.create_toast_notifier();
#define your notification as string
tString = """
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Sample toast</text>
<text>Sample content</text>
</binding>
</visual>
</toast>
"""
#convert notification to an XmlDocument
xDoc = dom.XmlDocument()
xDoc.load_xml(tString)
#display notification
notifier.show(notifications.ToastNotification(xDoc))
The Toast Content article explains how the content is created, either through code or XML. Buttons are described here, eg :
<actions>
<action
content="See more details"
arguments="action=viewdetails&contentId=351"
activationType="foreground"/>
<action
content="Remind me later"
arguments="action=remindlater&contentId=351"
activationType="background"/>
</actions>
Once an action is selected, the arguments are sent to the application