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¶
-
class
kivymd.vendor.circularTimePicker.CircularLayout(**kwargs)¶ Bases:
kivy.uix.layout.LayoutCircular layout class. See module documentation for more information.
-
padding¶ Padding between the layout box and it’s children: [padding_left, padding_top, padding_right, padding_bottom].
padding also accepts a two argument form [padding_horizontal, padding_vertical] and a one argument form [padding].
paddingis aVariableListPropertyand defaults to [0, 0, 0, 0].
-
start_angle¶ Angle (in degrees) at which the first widget will be placed. Start counting angles from the X axis, going counterclockwise.
start_angleis aNumericPropertyand defaults to 0 (start from the right).
-
circle_quota¶ Size (in degrees) of the part of the circumference that will actually be used to place widgets.
circle_quotais aBoundedNumericPropertyand defaults to 360 (all the circumference).
-
direction¶ Direction of widgets in the circle.
directionis anOptionPropertyand defaults to ‘ccw’. Can be ‘ccw’ (counterclockwise) or ‘cw’ (clockwise).
-
outer_radius_hint¶ Sets the size of the outer circle. A number greater than 1 will make the widgets larger than the actual widget, a number smaller than 1 will leave a gap.
outer_radius_hintis aNumericPropertyand defaults to 1.
-
inner_radius_hint¶ Sets the size of the inner circle. A number greater than
outer_radius_hintwill cause glitches. The closest it is toouter_radius_hint, the smallest will be the widget in the layout.outer_radius_hintis aNumericPropertyand defaults to 1.
-
radius_hint¶ Combined
outer_radius_hintandinner_radius_hintin a list for convenience. See their documentation for more details.
-
delta_radii¶
-
do_layout(self, *largs)¶
-
-
class
kivymd.vendor.circularTimePicker.ThemableBehavior(**kwargs)¶ Bases:
kivy.event.EventDispatcher-
theme_cls¶ Instance of
ThemeManagerclass.theme_clsis anObjectProperty.
-
device_ios¶ Trueif device isiOS.device_iosis anBooleanProperty.
-
opposite_colors¶
-
-
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¶ Bases:
kivy.uix.label.LabelThe class used to show the numbers in the selector.
-
size_factor¶ Font size scale.
size_factoris aNumericPropertyand defaults to 0.5.
-
-
class
kivymd.vendor.circularTimePicker.CircularNumberPicker(**kw)¶ Bases:
kivymd.vendor.circleLayout.CircularLayoutA circular number picker based on CircularLayout. A selector will help you pick a number. You can also set
multiples_ofto make it show only some numbers and use the space in between for the other numbers.-
min¶ The first value of the range.
minis aNumericPropertyand 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.maxis aNumericPropertyand defaults to 0.
-
range¶ Packs
minandmaxinto a list for convenience. See their documentation for further information.rangeis 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_ofis aNumericPropertyand defaults to 1.
-
selector_color¶ Color of the number selector. RGB.
selector_coloris aListPropertyand defaults to [.337, .439, .490] (material green).
-
color¶ Color of the number labels and of the center dot. RGB.
coloris aListPropertyand defaults to [1, 1, 1] (white).
-
selector_alpha¶ Alpha value for the transparent parts of the selector.
selector_alphais aBoundedNumericPropertyand defaults to 0.3 (min=0, max=1).
-
selected¶ Currently selected number.
selectedis aNumericPropertyand defaults tomin.
-
number_size_factor¶ Font size scale factor for the
Number.number_size_factoris aNumericPropertyand 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_stringis aStringPropertyand defaults to “{}”.
-
scale¶ Canvas scale factor. Used in
CircularTimePickertransitions.scaleis aNumericPropertyand defaults to 1.
-
items¶
-
shown_items¶
-
dot_is_none(self, *args)¶
-
on_touch_down(self, touch)¶
-
on_touch_move(self, touch)¶
-
on_touch_up(self, touch)¶
-
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)¶ Bases:
kivymd.vendor.circularTimePicker.CircularNumberPickerCircularNumberPickerimplementation for minutes.
-
class
kivymd.vendor.circularTimePicker.CircularHourPicker(**kw)¶ Bases:
kivymd.vendor.circularTimePicker.CircularNumberPickerCircularNumberPickerimplementation for hours.
-
class
kivymd.vendor.circularTimePicker.CircularTimePicker(**kw)¶ Bases:
kivy.uix.boxlayout.BoxLayout,kivymd.theming.ThemableBehaviorWidget that makes use of
CircularHourPickerandCircularMinutePickerto 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).
hoursis aNumericPropertyand defaults to 0 (12am).
-
minutes¶ The minutes.
minutesis aNumericPropertyand 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_formatis aStringPropertyand 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_formatis aStringPropertyand 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”.
pickeris aOptionPropertyand defaults to “hours”.
-
selector_color¶ Color of the number selector and of the highlighted text. RGB.
selector_coloris aListPropertyand defaults to [.337, .439, .490] (material green).
-
color¶ Color of the number labels and of the center dot. RGB.
coloris aListPropertyand defaults to [1, 1, 1] (white).
-
selector_alpha¶ Alpha value for the transparent parts of the selector.
selector_alphais aBoundedNumericPropertyand defaults to 0.3 (min=0, max=1).
-
time¶ Selected time as a datetime.time object.
timeis 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)¶
-
on_touch_up(self, touch)¶
-
-
kivymd.vendor.circularTimePicker.c¶