I'm working on my script to set the time in each time when I call the GoRight function.
I'm trying to set the time to 1 hour forward in each time when I call the GoRight function, but it would not let me to change from the current time in the setLabel method.
When I try this:
def GoRight(self):
# Set the date and time row
current_time = time.time() # now (in seconds)
half_hour = current_time + 60*30 # now + 30 minutes
one_hour = current_time + 60*60 # now + 60 minutes
for t in [current_time,half_hour,one_hour]:
if (0 <= datetime.datetime.now().minute <= 30):
self.getControl(346).setLabel(time.strftime("%I" + ":30%p",time.localtime(t)).lstrip("0"))
else:
self.getControl(346).setLabel(time.strftime("%I" + ":00%p",time.localtime(t)).lstrip("0"))
It will show "5:00PM or 5:30PM in each time when I call the function. It will only show the time from my current time. I want to add it to one hour forward in each time when I call the function.
I'm trying to set the time to one hour forward in each time when I call the function, example: I call the function to use the setLabel method to add the time to one hour forward in each time 5:30PM
, 6:00PM
, 6:30PM
, 7:00PM
, 7:30PM
...etc
Can you please show me an simple example of how I can set the time to one hour forward in each time when I use to call the function?