사용자가 지정한 시간마다 업데이트를 확인하고 그에 대한 알림 메시지를 표시하는 함수를 작성했습니다. 내 코드 :지정된 시간마다 wxPython.NotificationMessage 호출
def show_notification():
notification_bubble = wx.App()
wx.adv.NotificationMessage("", "sample notification").Show()
notification_bubble.MainLoop()
def update():
# retrieve var from newest_porcys_url_imported
first_porcys_url = newest_porcys_url_imported()
# retrieve var from newest_pitchfork_url_imported
first_pitchfork_url = newest_pitchfork_url_imported()
# fetch newest review url with get_porcys_review_url
get_latest_porcys_url_ = get_porcys_review_url()
get_latest_porcys_url = get_latest_porcys_url_[0]
# fetch newest review url with get_pitchfork_review_url
get_latest_pitchfork_url_ = get_pitchfork_review_url()
get_latest_pitchfork_url = get_latest_pitchfork_url_[0]
a = first_porcys_url + ' ' + get_latest_porcys_url
b = first_pitchfork_url + ' ' + get_latest_pitchfork_url
get_datetime = datetime.now()
hour = str(get_datetime.hour)
minutes = str(get_datetime.minute)
f = open('log.txt', 'a')
f.write(hour + ':' + minutes + ' ' + a + ' ' + b + '\n')
f.close()
if first_porcys_url != get_latest_porcys_url or first_pitchfork_url != get_latest_pitchfork_url:
print('new reviews')
f = open('new reviews.txt', 'a')
f.write(hour + ':' + minutes + ' ' + a + ' ' + b + '\n')
f.close()
return True
else:
show_notification()
return False
내 문제는 단지 통보 한 시간을 표시한다는 것입니다 그것은 업데이 트 기능을 실행을 포함하여 아무 것도 수행하지 않습니다 그 후. 나는 call_function()을 print 인스트럭션으로 바꾸었다. 테스트를 위해 모든 것이 잘 작동했기 때문에이 함수를 호출하면 문제가 발생한다.