How to use the kivy.properties.NumericProperty function in Kivy

To help you get started, we’ve selected a few Kivy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HeaTTheatR / KivyMD / kivymd / stiffscroll / __init__.py View on Github external
"""

    transition_max = ObjectProperty(AnimationTransition.in_cubic)
    """The AnimationTransition function to use when adjusting the friction
    near the maximum end of the effect.

    """

    target_widget = ObjectProperty(None, allownone=True, baseclass=Widget)
    """The widget to apply the effect to."""

    displacement = NumericProperty(0)
    """The absolute distance moved in either direction."""

    scroll = NumericProperty(0.0)
    """The distance to be used for scrolling."""

    def __init__(self, **kwargs):
        """Set ``self.base_friction`` to the value of ``self.friction`` just
        after instantiation, so that I can reset to that value later.

        """

        super().__init__(**kwargs)
        self.base_friction = self.friction

    def update_velocity(self, dt):
        """Before actually updating my velocity, meddle with ``self.friction``
        to make it appropriate to where I'm at, currently.

        """
github kivy-garden / garden.circulardatetimepicker / __init__.py View on Github external
# Clock.schedule_once(self._genitems)
        Clock.schedule_once(self._update_start_angle)
        Clock.schedule_once(self.on_selected)

    def _update_start_angle(self, *a):
        self.start_angle = (360. / self.shown_items / 2) - 90

class CircularTimePicker(BoxLayout):
    """Widget that makes use of :class:`CircularHourPicker` and
    :class:`CircularMinutePicker` to create a user-friendly, animated
    time picker like the one seen on Android.

    See module documentation for more details.
    """

    hours = NumericProperty(0)
    """The hours, in military format (0-23).

    :attr:`hours` is a :class:`~kivy.properties.NumericProperty` and
    defaults to 0 (12am).
    """

    minutes = NumericProperty(0)
    """The minutes.

    :attr:`minutes` is a :class:`~kivy.properties.NumericProperty` and
    defaults to 0.
    """

    time_list = ReferenceListProperty(hours, minutes)
    """Packs :attr:`hours` and :attr:`minutes` in a list for convenience.
github wolfmanjm / kivy-smoothie-host / dial-gauge.py View on Github external
scale_max = NumericProperty(100.0)
    scale_min = NumericProperty(0.0)
    scale_increment = NumericProperty(10.0)
    angle_start = NumericProperty(0.0)
    angle_stop = NumericProperty(360.0)
    angle_offset = NumericProperty(0.0)
    tic_frequency = NumericProperty(2.0)
    tic_length = NumericProperty(8)
    tic_width = NumericProperty(2)
    tic_radius = NumericProperty(100)
    tic_color = ListProperty([0, 0, 1])
    dial_color = ListProperty([1, 1, 1])
    needle_color = ListProperty([1, 0, 0])
    hub_color = ListProperty([1, 0, 0])
    needle_length = NumericProperty(100)
    needle_width = NumericProperty(4)
    hub_radius = NumericProperty(20)
    semi_circle = BooleanProperty(False)
    value = NumericProperty(0.0)
    value_offset_pos = ListProperty([0, 0])
    show_value = BooleanProperty(True)
    value_color = ListProperty([0, 0, 1, 1])
    value_font_size = NumericProperty(20)
    scale_font_size = NumericProperty(10)
    annulars = ListProperty()
    annular_thickness = NumericProperty(8)

    setpoint_thickness = NumericProperty(2)
    setpoint_length = NumericProperty(None)
    setpoint_value = NumericProperty(float('nan'))
    setpoint_color = ListProperty([0, 0, 0, 1])
github inclement / noGo / boardview.py View on Github external
pass
class MakeCircleMarker(EditMarker):
    pass
class MakeCrossMarker(EditMarker):
    pass
class MakeEmptyMarker(EditMarker):
    pass
    

class PickNewVarType(FloatLayout):
    board = ObjectProperty(None)
    popup = ObjectProperty(None)
    coord = ListProperty((0,0))

class GuiBoard(Widget):
    gridsize = NumericProperty(19) # Board size
    navmode = StringProperty('Navigate') # How to scale the board
    abstractboard = ObjectProperty(None,allownone=True) # Object to query for where to play moves
    uielements = DictProperty({})
    makemovemarker = ObjectProperty(None,allownone=True)
    touchoffset = ListProperty([0,0])
    guesses = ListProperty([0,0])
    gameinfo = DictProperty({})
    sgf_model = ObjectProperty(None,allownone=True)

    #kinterface = ObjectProperty(None)

    #areamarker = ObjectProperty(None, allownone=True)

    input_mode = OptionProperty('play',options=['play',
                                                'mark_tri',
                                                'mark_squ',
github kivy / kivy-designer / designer / uix / contextual.py View on Github external
auto_width = BooleanProperty(True)
    '''By default, the width of the ContextMenu will be the same
       as the width of the attached widget. Set to False if you want
       to provide your own width.
    '''

    dismiss_on_select = BooleanProperty(True)
    '''By default, the ContextMenu will be automatically dismissed
    when a selection have been done. Set to False to prevent the dismiss.

    :data:`dismiss_on_select` is a :class:`~kivy.properties.BooleanProperty`,
    default to True.
    '''

    max_height = NumericProperty(None, allownone=True)
    '''Indicate the maximum height that the dropdown can take. If None, it will
    take the maximum height available, until the top or bottom of the screen
    will be reached.

    :data:`max_height` is a :class:`~kivy.properties.NumericProperty`, default
    to None.
    '''

    __events__ = ('on_select', 'on_dismiss')

    def __init__(self, **kwargs):
        self._win = None
        self.add_tab = super(ContextMenu, self).add_widget
        self.bubble = self.bubble_cls(size_hint=(None, None))
        self.container = None
        self.main_tab = self.header_cls(text='Main')
github Kovak / FlatKivy / flat_kivy / ui_elements.py View on Github external
theme_def = theme[each]
                    except:
                        print(each, 'not in theme', value[0], value[1])
                        continue
                    for propname in theme_def:
                        setattr(self, propname, theme_def[propname])


class TouchRippleBehavior(object):
    ripple_rad = NumericProperty(10)
    ripple_pos = ListProperty([0, 0])
    ripple_color = ListProperty((0., 0., 0., 1.))
    ripple_duration_in = NumericProperty(.7)
    ripple_duration_out = NumericProperty(.3)
    fade_to_alpha = NumericProperty(.12)
    ripple_scale = NumericProperty(4.0)
    ripple_func_in = StringProperty('in_cubic')
    ripple_func_out = StringProperty('out_quad')

    def on_touch_down(self, touch):
        if self in touch.ud:
            self.anim_complete(self, self)
            self.ripple_pos = ripple_pos = (touch.x, touch.y)
            Animation.cancel_all(self, 'ripple_rad', 'ripple_color')
            rc = self.ripple_color
            ripple_rad = self.ripple_rad
            self.ripple_color = [rc[0], rc[1], rc[2], .16]
            anim = Animation(
                ripple_rad=max(self.width, self.height) * self.ripple_scale, 
                t=self.ripple_func_in,
                ripple_color=[rc[0], rc[1], rc[2], self.fade_to_alpha],
                duration=self.ripple_duration_in)
github HeaTTheatR / KivyMD / demos / kitchen_sink / main.py View on Github external
alert_dialog = ObjectProperty()
    ok_cancel_dialog = ObjectProperty()
    dialog = ObjectProperty()
    user_card = ObjectProperty()
    my_snackbar = ObjectProperty(None, allownone=True)
    dialog_load_kv_files = ObjectProperty()

    create_stack_floating_buttons = BooleanProperty(False)
    manager_open = BooleanProperty(False)
    cards_created = BooleanProperty(False)
    toolbar_hide = BooleanProperty(False)

    _interval = NumericProperty(0)
    tick = NumericProperty(0)
    x = NumericProperty(0)
    y = NumericProperty(25)
    file_source_code = StringProperty("", allownone=True)
    directory = StringProperty()

    menu_items = ListProperty()
    hex_primary_color = StringProperty()
    previous_text = StringProperty()
    previous_text_end = StringProperty()
    names_contacts = ListProperty(
        (
            "Alexandr Taylor",
            "Yuri Ivanov",
            "Robert Patric",
            "Bob Marley",
            "Magnus Carlsen",
            "Jon Romero",
            "Anna Bell",
github kpiorno / kivy3dgui / kivy3dgui / node.py View on Github external
effect = BooleanProperty(False)
    receive_shadows = BooleanProperty(True)
    cast_shadows = BooleanProperty(True)
    alpha_blending = BooleanProperty(False)
    flip_coords = BooleanProperty(True)
    lighting = BooleanProperty(True)
    texture = StringProperty("")
    normal_map = StringProperty("")
    _normal_map = StringProperty("")
    _instruction_group = ObjectProperty(None, allownone=True)
    specular_intensity = NumericProperty(0.0)
    specular_power = NumericProperty(0.0)
    min_light_intensity = NumericProperty(0.0)
    always_on_top = BooleanProperty(False)

    alpha = NumericProperty(1.0)
    alpha_threshold = NumericProperty(1.0)
    axis_type = NumericProperty(0)
    
    shadows_bias = NumericProperty(0.01)
    
    light_intensity = [1.0, 1.0, 1.0, 1.0]
    old_transformation = [1.0, 0.0, 0.0, 1300.0, True]
    orientation_vector = [1.0, 1.0, 1.0, 1.0]
    texture_size = ListProperty([-1, -1])
    _instructions = ListProperty([])
    _shadow_instructions = ListProperty([])
    _picking_instructions = ListProperty([])
    _blur_instructions = ListProperty([])

    _translate = None
    _rotate = None
github chaosbuffalolabs / ParticlePanda / main.py View on Github external
class ColorPanel(Widget):
    particle_builder = ObjectProperty(None)

    start_color = ListProperty([1,1,1,1])
    end_color = ListProperty([1,1,1,1])
    start_color_r_variance = NumericProperty(.1)
    start_color_r_variance_min = NumericProperty(0)
    start_color_r_variance_max = NumericProperty(1.)
    start_color_g_variance = NumericProperty(.1)
    start_color_g_variance_min = NumericProperty(0)
    start_color_g_variance_max = NumericProperty(1.)
    start_color_b_variance = NumericProperty(.1)
    start_color_b_variance_min = NumericProperty(0)
    start_color_b_variance_max = NumericProperty(1.)
    start_color_a_variance = NumericProperty(.1)
    start_color_a_variance_min = NumericProperty(0)
    start_color_a_variance_max = NumericProperty(1.)
    end_color_r_variance = NumericProperty(.1)
    end_color_r_variance_min = NumericProperty(0)
    end_color_r_variance_max = NumericProperty(1.)
    end_color_g_variance = NumericProperty(.1)
    end_color_g_variance_min = NumericProperty(0)
    end_color_g_variance_max = NumericProperty(1.)
    end_color_b_variance = NumericProperty(.1)
    end_color_b_variance_min = NumericProperty(0)
    end_color_b_variance_max = NumericProperty(1.)
    end_color_a_variance = NumericProperty(.1)
    end_color_a_variance_min = NumericProperty(0)
    end_color_a_variance_max = NumericProperty(1.)
    current_blend_src = NumericProperty(0, allownone = True)
    current_blend_dest = NumericProperty(0, allownone = True)
github chaosbuffalolabs / ParticlePanda / kivyparticle / engine.py View on Github external
class Particle(object):
    x, y, rotation, current_time = -256, -256, 0, 0
    scale, total_time = 1.0, 0.
    color = [1.0, 1.0, 1.0, 1.0]
    color_delta = [0.0, 0.0, 0.0, 0.0]
    start_x, start_y, velocity_x, velocity_y = 0, 0, 0, 0
    radial_acceleration, tangent_acceleration = 0, 0
    emit_radius, emit_radius_delta = 0, 0
    emit_rotation, emit_rotation_delta = 0, 0
    rotation_delta, scale_delta = 0, 0


class ParticleSystem(Widget):
    max_num_particles = NumericProperty(200)
    life_span = NumericProperty(2)
    texture = ObjectProperty(None)
    texture_path = StringProperty(None)
    life_span_variance = NumericProperty(0)
    start_size = NumericProperty(16)
    start_size_variance = NumericProperty(0)
    end_size = NumericProperty(16)
    end_size_variance = NumericProperty(0)
    emit_angle = NumericProperty(0)
    emit_angle_variance = NumericProperty(0)
    start_rotation = NumericProperty(0)
    start_rotation_variance = NumericProperty(0)
    end_rotation = NumericProperty(0)
    end_rotation_variance = NumericProperty(0)
    emitter_x_variance = NumericProperty(100)
    emitter_y_variance = NumericProperty(100)