Reputation: 151
I'm trying to display a popup window at a time specified by the user? The popup only shows up on the precoded time, so I tried this. Now I'm receiving an error saying: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
class MainApp(MDApp):
hour = NumericProperty(None, allowenone=True)
minute = NumericProperty(None, allowenone=True)
def build(self):
# calling the service
if platform == "android":
from android import AndroidService
service = AndroidService("my pong service", "running")
service.start("service started")
self.service = service
schedule.every().day.at(f'{int(self.hour)}:{int(self.minute)}').do(self.mantraPop_message)
#schedule.every().day.at(str(0) + str(self.hour) + ":" + str(self.minute)).do(self.show_notification)
Clock.schedule_interval(lambda dt: schedule.run_pending(), 1)
return MainScreen()
def show_timepicker(self):
picker = MDTimePicker()
picker.bind(time=self.got_time)
picker.open()
def got_time(self, picker_widget, time):
self.hour = time.hour
self.minute = time.minute
print(f'{int(self.hour)}:{int(self.minute)}')
Upvotes: 0
Views: 106
Reputation: 151
schedule.every().day.at(f'{int(self.hour)}:{int(self.minute)}').do(self.mantraPop_message)
should be placed in def got_time():
so that it will call schedule every time that the time is set. self.hour
can also be empty now. What was happening before was that when the app runs, the scheduling begins and cannot be updated so now, the scheduling only begins when the time has been set by the user.
Upvotes: 1