3

Python と Libnotify を使用してデスクトップ通知システムを開発しようとしています。

このチュートリアルを見つけて、アクション コールバックを使用して例を試しました。以下はコードの変更です。

#initialization of libnotify
Notify.init("Py-Notification")

#creating object
summary = "Wake Up!"
body = "Meeting at 9pm"
notification = Notify.Notification.new(
    summary, body
)    

# Define a callback function
def my_callback_func():
    webbrowser.open('http://google.com')

#adding actions
notification.add_action(
    "action_click",
    "Reply to Alarm",
    my_callback_func,
    None # Arguments
)   

notification.show()

[アラームに応答] ボタンをクリックしてもコールバック関数が呼び出されない

どんな助けでも。

4

1 に答える 1