Print out the time and the surrounding letters as a continuous set of characters, changing the colour of the text as it is rendered out.Print out the text as one big string and then use a find replace method to inject a different colour of text into the output.There are a few different avenues we could go down here, for example we could do one of the following. I thought for a while how to go about creating the clock. For example, for the time "IT IS FIVE TO NINE AM" we would alter the colour of the letters to make that particular set of characters stand out. The idea is that when we want to display the time we just change the font style on the letters we need, rather than turning on or off lights. This is the final collection of letters that I came up with to make up the clock. There are a few things to figure out here, but the first task is to create the words. This ties in quite closely to my article on converting the current time into a sentence in Python, so I already had quite a bit of the logic figured out. Using Tkinter to create the clock as a GUI application seemed like a nice little project to get used ti Tkinter and Python. That clock design I found didn't display the AM or PM of the time, so I ended up tweaking that design a little anyway. ![]() ![]() The original clock was of a proprietary design so I set about creating one that was based more on an open source clock design that I found. Without the lights the clock looks like a jumble of letters, it is only when the light is on that the relevant time is displayed. The clock was essentially a wall of letters with lights behind that light up depending on what time it is. I recently saw a design of a physical clock that inspired me to go about creating one using Python and Tkinter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |