-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.kv
More file actions
28 lines (26 loc) · 847 Bytes
/
Copy pathclock.kv
File metadata and controls
28 lines (26 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from datetime import datetime
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.pickers import MDTimePicker
KV = """
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDButton:
pos_hint: {"center_x": .5, "center_y": .5}
on_release: app.show_time_picker()
MDButtonText:
text: "Open Time Picker"
"""
class TimePickerApp(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
def show_time_picker(self):
time_dialog = MDTimePicker()
time_dialog.bind(on_save=self.on_save)
time_dialog.open()
def on_save(self, instance, time):
"""Called when the user clicks 'OK' on the time picker."""
print(f"Selected time: {time}")
if __name__ == "__main__":
TimePickerApp().run()