- Apr 4, 2022
- 22
- 5
The above is my code for changing period of a day and weekdays. It works fine when starting from Sunday but it gets stuck on Monday Early morning and doesn't move forward in time. How can I fix this issue/CODE:
default day = 1
default time_stamp= 0
default time_of_day = "Early Morning"
default day_name = "Sunday"
init:
$ day_image = "images/sonntag.png"
$ time_image = "images/fmorgen.png"
screen time_display:
if time_stamp <10 :
$ time_of_day = "Early_Morning"
elif time_stamp >=10 and time_stamp <20 :
$ time_of_day = "Morning"
$ time_image ="images/morgen.png"
elif time_stamp >= 20 and time_stamp <30 :
$ time_of_day = "Noon"
$ time_image = "images/mittags.png"
elif time_stamp >= 30 and time_stamp <40 :
$ time_of_day = "After_Noon"
$ time_image = "images/mittags.png"
elif time_stamp >= 40 and time_stamp <50 :
$ time_of_day = "Evening"
$ time_image = "images/abends.png"
elif time_stamp >= 50 and time_stamp <60 :
$time_of_day = "Night"
$ time_image = "images/nachts.png"
elif time_stamp >= 60:
$ day += 1
$ time_stamp = 0
if day == 1:
$day_name = "Sunday"
$ day_image = "images/sonntag.png"
elif day == 2:
$day_name = "Monday"
$ day_image = "images/montag.png"
elif day == 3:
$day_name = "Tuesday"
$ day_image = "images/dienstag.png"
elif day == 4:
$day_name = "Wednesday"
$ day_image = "images/mittwoch.png"
elif day == 5:
$day_name = "Thursday"
$ day_image = "images/donnerstag.png"
elif day == 6:
$day_name = "Friday"
$ day_image = "images/Freitag.png"
elif day == 7:
$day_name = "Saturday"
$ day_image = "images/samstag.png"
elif day == 8:
$day = 1
Last edited: