Babber / KivyMD-TimePicker-with-24h-support

The TimePicker widget from KivyMD extended with the option of a 24h (military) clock
MIT License
10 stars 1 forks source link

KivyMD TimePicker with 24-hour time support

According to Wikipedia:

The 12-hour time convention is common in several English-speaking nations and former British colonies, as well as a few other countries. ... In most countries, however, the 24-hour clock is the standard system used, especially in writing. ... This system, as opposed to the 12-hour clock, is the most commonly used time notation in the world today, and is used by the international standard ISO 8601.

Unfortunately, the KivyMD project removed the option of a 24-hour clock as unnecessary, at the same time also referring to some Material Design related reasons, which are rather unclear to me. (See this thread for yourself.) To my enquiry asking what happens if I implement this feature myself, I was told that they consciously got rid of the functionality. This is why I post this outcast feature myself instead of a pull request to the KivyMD repo. If you like this feature of a 24-hour clock or you simply want to show your support for an inclusive TimePicker that offers both options thus making everyone happy, please, consider giving this tiny repo a Star. Who knows, if it gains enough popularity, maybe it could be part of KivyMD one day?..

Independently of this design detail, I would like to express my great appreciation to all the Contributors of the KivyMD project, which I find a very useful and valuable extension to Kivy!


How to use timepicker.py in a desktop environment?

Releases of this repo are tagged as v<version numbers>+<hash of the KivyMD master branch that the current patch is based on>. If you use the given KivyMD release or one that is sufficiently similar, just replace /kivymd/uix/pickers/timepicker/timepicker.py with the file from here, then...

#MDTimePicker.AMPM_or_24h="24h"   # to use the 24h clock (the default setting)
#MDTimePicker.AMPM_or_24h="AMPM"  # to use the 12h clock

time_dialog = MDTimePicker()


How to make use of it with Buildozer or python-for-android?

The patch in the recipe is also based on the same version of the KivyMD master branch as timepicker.py, see above. To apply this recipe, follow the steps below:


TimePicker with 24h support