Clock with verbose text and speech output (in English and Dutch)
This is "itsabouttime", one of my fist Pythonista progams.
It is a clock that spells out the time. On top of that, it can say the time by clicking on the time field.
If you press the Language button, the languages toggles between English and Dutch (my native language).
If you press the on/off button labeled "Say time each minute", this function is toggled.
Maybe the on/off button is the most reusable part, as I couln't find anything in the Pythonista examples yet.
- Each call to convert2en(n) and convert2nl(n) creates in the variable c the full text for all numbers from zero through ninety nine no matter what the value of n is. This a is very impressive piece of code! However, instead of creating this full list on every call to these functions, you might consider making the list just once during startup and then reusing it over and over again.
- Consider changing:
hour = t.tm_hour % 12 # ...to... hour = (t.tm_hour % 12) or 12
which would allow you to eliminate both convert2hen() and convert2hnl().
Thank you for the valueable remarks.
I am very pleased with this forum as we can learn from each other.
I have incorporated ccc comments and applied some minor changes to the code.