私は、ユーザが指定したすべての時刻をチェックし、もしあればそれに関する通知メッセージを表示する関数を作成しました。 マイコード:指定された時間ごとに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
私の問題は、それが唯一の通知1時間を表示し、その後、それは更新機能を実行するなど、何かを、行いませんということです。私はcall_function()とprintの指示をテストのために置き換えました。すべてうまくいきました。その機能を呼び出すことは問題を引き起こしています。