The time function stores one extra piece of information we haven't used yet - what day of the week it is:
time['weekday']
If you ask the micro:bit to display this, it will give you a number - Monday is 1, Saturday is 6.
To do different things at different times of the day, you need to make some comparisons.
We first need to convert the hours into a number, so that we can do some maths with it:
int(time['hours'])
This converts the string into an integer, which means a whole number.
Now we can compare the current time, for example by asking if it is after midnight, but before midday:
if 0 <= int(time['hours']) < 12:
display.show(Image.YES)
In the above statement we are asking the micro:bit if the hour is 0 or more (so it is after midnight), and also if 12 is more than the hour (so it hasn't reached midday yet). If both of these things are true, we get an image shown.
A good place to put this code is in your else statement - so the micro:bit will check every time it loops.
You will need to take away the display.clear() line of code to make sure your images are displayed.
A full version of this code is below for you to add to your program, modify, and test.
display.show(Image.DUCK)
sleep(1000)
while True:
if button_a.is_pressed():
time = get_time()
display.scroll(time['year'])
else:
time = get_time()
if 0 <= int(time['hours']) < 12:
display.show(Image.YES)
if 12 <= int(time['hours']) < 0:
display.show(Image.NO)
sleep(100)