Circular Date & Time Picker for Kivy¶
(currently only time, date coming soon)
Based on [CircularLayout](https://github.com/kivy-garden/garden.circularlayout). The main aim is to provide a date and time selector similar to the one found in Android KitKat+.
Simple usage¶
Import the widget with
from kivy.garden.circulardatetimepicker import CircularTimePicker
then use it! That’s it!
c = CircularTimePicker()
c.bind(time=self.set_time)
root.add_widget(c)
in Kv language:
<TimeChooserPopup@Popup>:
BoxLayout:
orientation: "vertical"
CircularTimePicker
Button:
text: "Dismiss"
size_hint_y: None
height: "40dp"
on_release: root.dismiss()
API - kivymd.vendor.circularTimePicker
¶
-
kivymd.vendor.circularTimePicker.
xrange
(first=None, second=None, third=None)¶
-
kivymd.vendor.circularTimePicker.
map_number
(x, in_min, in_max, out_min, out_max)¶
-
kivymd.vendor.circularTimePicker.
rgb_to_hex
(*color)¶
-
class
kivymd.vendor.circularTimePicker.
Number
(**kwargs)¶ The class used to show the numbers in the selector.
-
size_factor
¶ Font size scale.
size_factor
is aNumericProperty
and defaults to 0.5.
-
-
class
kivymd.vendor.circularTimePicker.
CircularNumberPicker
(**kw)¶ A circular number picker based on CircularLayout. A selector will help you pick a number. You can also set
multiples_of
to make it show only some numbers and use the space in between for the other numbers.-
min
¶ The first value of the range.
min
is aNumericProperty
and defaults to 0.
-
max
¶ The last value of the range. Note that it behaves like xrange, so the actual last displayed value will be
max
- 1.max
is aNumericProperty
and defaults to 0.
-
range
¶ Packs
min
andmax
into a list for convenience. See their documentation for further information.range
is aReferenceListProperty
.
-
multiples_of
¶ Only show numbers that are multiples of this number. The other numbers will be selectable, but won’t have their own label.
multiples_of
is aNumericProperty
and defaults to 1.
-
selector_color
¶ Color of the number selector. RGB.
selector_color
is aListProperty
and defaults to [.337, .439, .490] (material green).
-
color
¶ Color of the number labels and of the center dot. RGB.
color
is aListProperty
and defaults to [1, 1, 1] (white).
-
selector_alpha
¶ Alpha value for the transparent parts of the selector.
selector_alpha
is aBoundedNumericProperty
and defaults to 0.3 (min=0, max=1).
-
selected
¶ Currently selected number.
selected
is aNumericProperty
and defaults tomin
.
-
number_size_factor
¶ Font size scale factor for the
Number
.number_size_factor
is aNumericProperty
and defaults to 0.5.
-
number_format_string
¶ String that will be formatted with the selected number as the first argument. Can be anything supported by
str.format()
(es. “{:02d}”).number_format_string
is aStringProperty
and defaults to “{}”.
-
scale
¶ Canvas scale factor. Used in
CircularTimePicker
transitions.scale
is aNumericProperty
and defaults to 1.
-
items
¶
-
shown_items
¶
-
dot_is_none
(self, *args)¶
-
on_touch_down
(self, touch)¶ Receive a touch down event.
- Parameters
- touch:
MotionEvent
class Touch received. The touch is in parent coordinates. See
relativelayout
for a discussion on coordinate systems.
- touch:
- Returns
bool If True, the dispatching of the touch event will stop. If False, the event will continue to be dispatched to the rest of the widget tree.
-
on_touch_move
(self, touch)¶ Receive a touch move event. The touch is in parent coordinates.
See
on_touch_down()
for more information.
-
on_touch_up
(self, touch)¶ Receive a touch up event. The touch is in parent coordinates.
See
on_touch_down()
for more information.
-
on_selected
(self, *a)¶
-
pos_for_number
(self, n)¶ Returns the center x, y coordinates for a given number.
-
number_at_pos
(self, x, y)¶ Returns the number at a given x, y position. The number is found using the widget’s center as a starting point for angle calculations.
Not thoroughly tested, may yield wrong results.
-
-
class
kivymd.vendor.circularTimePicker.
CircularMinutePicker
(**kw)¶ CircularNumberPicker
implementation for minutes.
-
class
kivymd.vendor.circularTimePicker.
CircularHourPicker
(**kw)¶ CircularNumberPicker
implementation for hours.
-
class
kivymd.vendor.circularTimePicker.
CircularTimePicker
(**kw)¶ Widget that makes use of
CircularHourPicker
andCircularMinutePicker
to create a user-friendly, animated time picker like the one seen on Android.See module documentation for more details.
-
primary_dark
¶
-
hours
¶ The hours, in military format (0-23).
hours
is aNumericProperty
and defaults to 0 (12am).
-
minutes
¶ The minutes.
minutes
is aNumericProperty
and defaults to 0.
-
time_format
¶ String that will be formatted with the time and shown in the time label. Can be anything supported by
str.format()
. Make sure you don’t remove the refs. See the default for the arguments passed to format.time_format
is aStringProperty
and defaults to “[color={hours_color}][ref=hours]{hours}[/ref][/color]:[color={minutes_color}][ref=minutes] {minutes:02d}[/ref][/color]”.
-
ampm_format
¶ String that will be formatted and shown in the AM/PM label. Can be anything supported by
str.format()
. Make sure you don’t remove the refs. See the default for the arguments passed to format.ampm_format
is aStringProperty
and defaults to “[color={am_color}][ref=am]AM[/ref][/color][color={pm_color}][ref=pm]PM[/ref][/color]”.
-
picker
¶ Currently shown time picker. Can be one of “minutes”, “hours”.
picker
is aOptionProperty
and defaults to “hours”.
-
selector_color
¶ Color of the number selector and of the highlighted text. RGB.
selector_color
is aListProperty
and defaults to [.337, .439, .490] (material green).
-
color
¶ Color of the number labels and of the center dot. RGB.
color
is aListProperty
and defaults to [1, 1, 1] (white).
-
selector_alpha
¶ Alpha value for the transparent parts of the selector.
selector_alpha
is aBoundedNumericProperty
and defaults to 0.3 (min=0, max=1).
-
time
¶ Selected time as a datetime.time object.
time
is anAliasProperty
.
-
time_text
¶
-
ampm_text
¶
-
set_time
(self, dt)¶
-
on_ref_press
(self, ign, ref)¶
-
on_selected
(self, *a)¶
-
on_time_list
(self, *a)¶
-
on_ampm
(self, *a)¶
-
is_animating
(self, *args)¶
-
is_not_animating
(self, *args)¶
-
on_touch_down
(self, touch)¶ Receive a touch down event.
- Parameters
- touch:
MotionEvent
class Touch received. The touch is in parent coordinates. See
relativelayout
for a discussion on coordinate systems.
- touch:
- Returns
bool If True, the dispatching of the touch event will stop. If False, the event will continue to be dispatched to the rest of the widget tree.
-
on_touch_up
(self, touch)¶ Receive a touch up event. The touch is in parent coordinates.
See
on_touch_down()
for more information.
-
-
kivymd.vendor.circularTimePicker.
c
¶