Hey guys,
I need some help with my code because I have a bit of trouble with changing the 12 hours time when I'm trying to change the strings in the object.
When I try this:
def GoLeft(self):
if CurrentRow == 375:
if self.channel_page >= 0:
# Set the date and time row
getTime1 = self.getControl(344)
getTime2 = self.getControl(345)
getTime3 = self.getControl(346)
getTime3.setLabel(getTime2.getLabel())
getTime2.setLabel(getTime1.getLabel())
getTime1 = self.getControl(344).getLabel()
hour = time.strftime("%I").lstrip('0')
#Find the time for each clock to change the text
if getTime1 == '12:00AM':
self.getControl(344).setLabel('11:30AM')
elif getTime1 == '12:30AM':
self.getControl(344).setLabel('12:00AM')
elif getTime1 == '1:00AM':
self.getControl(344).setLabel('12:30AM')
elif getTime1 == '1:30AM':
self.getControl(344).setLabel('1:00AM')
elif getTime1 == '2:00AM':
self.getControl(344).setLabel('1:30AM')
elif getTime1 == '2:30AM':
self.getControl(344).setLabel('2:00AM')
elif getTime1 == '3:00AM':
self.getControl(344).setLabel('2:30AM')
elif getTime1 == '3:30AM':
self.getControl(344).setLabel('3:00AM')
elif getTime1 == '4:00AM':
self.getControl(344).setLabel('3:30AM')
elif getTime1 == '4:30AM':
self.getControl(344).setLabel('4:00AM')
elif getTime1 == '5:00AM':
self.getControl(344).setLabel('4:30AM')
elif getTime1 == '5:30AM':
self.getControl(344).setLabel('5:00AM')
elif getTime1 == '6:00AM':
self.getControl(344).setLabel('5:30AM')
elif getTime1 == '6:30AM':
self.getControl(344).setLabel('6:00AM')
elif getTime1 == '7:00AM':
self.getControl(344).setLabel('6:30AM')
elif getTime1 == '7:30AM':
self.getControl(344).setLabel('7:00AM')
elif getTime1 == '8:00AM':
self.getControl(344).setLabel('7:30AM')
elif getTime1 == '8:30AM':
self.getControl(344).setLabel('8:00AM')
elif getTime1 == '9:00AM':
self.getControl(344).setLabel('8:30AM')
elif getTime1 == '9:30AM':
self.getControl(344).setLabel('9:00AM')
elif getTime1 == '10:00AM':
self.getControl(344).setLabel('9:30AM')
elif getTime1 == '10:30AM':
self.getControl(344).setLabel('10:00AM')
elif getTime1 == '11:00AM':
self.getControl(344).setLabel('10:30AM')
elif getTime1 == '11:30AM':
self.getControl(344).setLabel('11:00AM')
elif getTime1 == '12:00PM':
self.getControl(344).setLabel('11:30AM')
elif getTime1 == '12:30PM':
self.getControl(344).setLabel('12:00PM')
elif getTime1 == '1:00PM':
self.getControl(344).setLabel('12:30AM')
elif getTime1 == '1:30PM':
self.getControl(344).setLabel('1:00PM')
elif getTime1 == '2:00PM':
self.getControl(344).setLabel('1:30PM')
elif getTime1 == '2:30PM':
self.getControl(344).setLabel('2:00PM')
elif getTime1 == '3:00PM':
self.getControl(344).setLabel('2:30PM')
elif getTime1 == '3:30PM':
self.getControl(344).setLabel('3:00PM')
elif getTime1 == '4:00PM':
self.getControl(344).setLabel('3:30PM')
elif getTime1 == '4:30PM':
self.getControl(344).setLabel('4:00PM')
elif getTime1 == '5:00PM':
self.getControl(344).setLabel('4:30PM')
elif getTime1 == '5:30PM':
self.getControl(344).setLabel('5:00PM')
elif getTime1 == '6:00PM':
self.getControl(344).setLabel('5:30PM')
elif getTime1 == '6:30PM':
self.getControl(344).setLabel('6:00PM')
elif getTime1 == '7:00PM':
self.getControl(344).setLabel('6:30PM')
elif getTime1 == '7:30PM':
self.getControl(344).setLabel('7:00PM')
elif getTime1 == '8:00PM':
self.getControl(344).setLabel('7:30PM')
elif getTime1 == '8:30PM':
self.getControl(344).setLabel('8:00PM')
elif getTime1 == '9:00PM':
self.getControl(344).setLabel('8:30PM')
elif getTime1 == '9:30PM':
self.getControl(344).setLabel('9:00PM')
elif getTime1 == '10:00PM':
self.getControl(344).setLabel('9:30PM')
elif getTime1 == '10:30PM':
self.getControl(344).setLabel('10:00PM')
elif getTime1 == '11:00PM':
self.getControl(344).setLabel('10:30PM')
elif getTime1 == '11:30PM':
self.getControl(344).setLabel('11:00PM')
It will let me to change the time to 30 mins back, e.g: from 1:30AM
to 1:00AM
. When I have the time 1:00AM
, it will not find the strings of 1:00AM
to change it to 12:30PM
. The reason for this is because I have two different type of AM
and PM
.
Can you please show me an example of how can I find the time between AM and PM before changing the strings in the object to the time that I actually want?