PySimpleGui SystemTray.notify 持续时间参数

PySimpleGui SystemTray.notify Duration Argument

我想使用 PySimpleGUIs SystemTray.notify class 方法发送 Windows 10 通知,该方法具有特定的持续时间或在单击之前根本不会消失。

在文档中您可以找到以下句子: “有一些选项可以控制淡入淡出、显示多长时间、alpha 通道等。请参阅本文档末尾的调用签名。”

但是我在文档中找不到更多信息。

我试过(突然)sg.SystemTray.notify('Notification Title', 'This is the notification message', duration=10) 会 return notify() got an unexpected keyword argument 'duration'

有人知道如何设置持续时间等吗?

参考SystemTray

以下示例显示方法,右键单击图标显示菜单。

import PySimpleGUI as sg

menu_def =  ['My_Menu', ['Notify', 'Show', 'Quit']]
tray = sg.SystemTray(menu=menu_def, data_base64=sg.EMOJI_BASE64_HAPPY_IDEA)

while True:

    event = tray.read()

    if event in (sg.WINDOW_CLOSED, 'Quit'):
        break
    elif event == 'Notify':
        tray.notify("Notify", "You got this notify", fade_in_duration=50, display_duration_in_ms=1000, alpha=0.5)
    elif event == 'Show':
        tray.show_message("Message", "You got this message", time=(50, 1000))

tray.close()