2016-06-20 7 views
2

저는 Python 및 Libnotify로 데스크탑 알림 시스템을 개발하려고합니다. 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() 

콜백 함수 내가 "알람에 회신"버튼을 클릭 할 때마다 호출되지이다,이 tutorial을 발견하고 액션 콜백의 예를 시도

도움이 필요해.

답변

1

알림에서 이벤트를 수신하려면 D BUS와 통합해야합니다.

Here is good explanation use Glib for it.

+0

이 작업을했는데 # GLib.timeout_add_seconds (10, self.check) 줄을 주석 처리해야했습니다. 이 선은 계속 알림을 보냈습니다. – jade