Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Clock with verbose text and speech output (in English and Dutch)
-
This is "itsabouttime", one of my fist Pythonista progams.
https://gist.github.com/9272923.git
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.
-
-
Two suggestions:
- 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.
-
Your code inspired me to create ToggleLayer.py https://github.com/cclauss/Pythonista_scene
LANGUAGES is now a list, instead of a tuple
A tuple is actually slightly a more efficient data structure than a list for objects that do not change at runtime. I believe that you had it right the first time.