How to use the kivy.properties.ObjectProperty 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 inclement / noGo / boardview.py View on Github external
elif mode == 'wstone':
            board.input_mode = 'wstone'
        elif mode == 'estone':
            board.input_mode = 'estone'
    def on_board_to_play(self,*args):
        toplay = self.board_to_play
        if toplay == 'w' and self.bplay_button.state == 'down':
            self.wplay_button.state = 'down'
            self.bplay_button.state = 'normal'
        elif toplay == 'b' and self.wplay_button.state == 'down':
            self.bplay_button.state = 'down'
            self.wplay_button.state = 'normal'
        

class CommentInput(BoxLayout):
    board = ObjectProperty(None)
    popup = ObjectProperty(None)
    comment = StringProperty('')

class SaveQuery(BoxLayout):
    collections_list = ObjectProperty(None,allownone=True)
    board = ObjectProperty(None,allownone=True)
    sgf_model = ObjectProperty(None,allownone=True)

def get_collectioninfo_from_dir(row_index,dirn):
    sgfs = glob(dirn + '/*.sgf')
    colname = dirn.split('/')[-1]
    return {'colname': colname, 'coldir': dirn, 'numentries': len(sgfs)}

class MySpinnerOption(SpinnerOption):
    pass
github kivy-garden / garden.rotabox / visual_editor / rotaboxer.py View on Github external
def on_drive_selected(self, *args):
        """ Changes the current drive letter in Windows OS.
        """
        try:
            selected_drive = args[0].text
        except IndexError:
            return
        self.filechooser.path = selected_drive


# noinspection PyIncorrectDocstring,PyArgumentList
class SaveDialog(BoxLayout):
    """ 'Save File' popup dialog.
    """
    save = ObjectProperty(None)
    cancel = ObjectProperty(None)
    file_types = ListProperty(['*.*'])
    text_input = ObjectProperty(None)

    def __init__(self, **kwargs):
        super(SaveDialog, self).__init__(**kwargs)
        self.filechooser.path = './'
        self.create_drives()

    def create_drives(self):
        """ Creates the Drive list in Windows OS.
        """
        for i in get_win_drives():
            btn = DarkButton(text=i)
            btn.bind(on_press=self.on_drive_selected)
            self.ids.drives_list.add_widget(btn)
github chaosbuffalolabs / ParticlePanda / kivyparticle / engine.py View on Github external
class Particle(object):
    x, y, rotation, current_time = 0, 0, 0, 0
    scale, total_time = 1.0, 1.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)
    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)
    gravity_x = NumericProperty(0)
    gravity_y = NumericProperty(0)
    speed = NumericProperty(0)
github kivy / pyobjus / examples / ball-example / main.py View on Github external
class Ball(Widget):

    velocity_x = NumericProperty(0)
    velocity_y = NumericProperty(0)
    h = NumericProperty(0)
    velocity = ReferenceListProperty(velocity_x, velocity_y)

    def move(self):
        self.pos = Vector(*self.velocity) + self.pos


class PyobjusGame(Widget):

    ball = ObjectProperty(None)
    screen = ObjectProperty(autoclass('UIScreen').mainScreen())
    accelerometer = Accelerometer()

    sensitivity = ObjectProperty(50)
    br_slider = ObjectProperty(None)

    def __init__(self, *args, **kwargs):
        super(PyobjusGame, self).__init__()
        self.accelerometer.start()

    def __dealloc__(self, *args, **kwargs):
        # self.bridge.stopAccelerometer()
        self.accelerometer.stop()
        super(PyobjusGame, self).__dealloc__()

    def reset_ball_pos(self):
        self.ball.pos = self.width / 2, self.height / 2
github pyKy / kivy-doc-ja / kivy / uix / effectwidget.py View on Github external
class EffectWidget(RelativeLayout):
    '''
    Widget with the ability to apply a series of graphical effects to
    its children. See the module documentation for more information on
    setting effects and creating your own.
    '''

    background_color = ListProperty((0, 0, 0, 0))
    '''This defines the background color to be used for the fbo in the
    EffectWidget.

    :attr:`background_color` is a :class:`ListProperty` defaults to
    (0, 0, 0, 0)
    '''

    texture = ObjectProperty(None)
    '''The output texture of the final :class:`~kivy.graphics.Fbo` after
    all effects have been applied.

    texture is an :class:`~kivy.properties.ObjectProperty` and defaults
    to None.
    '''

    effects = ListProperty([])
    '''List of all the effects to be applied. These should all be
    instances or subclasses of :class:`EffectBase`.

    effects is a :class:`ListProperty` and defaults to [].
    '''

    fbo_list = ListProperty([])
    '''(internal) List of all the fbos that are being used to apply
github kivy / kivent / kivent / gamesystems.py View on Github external
from kivy.uix.widget import Widget
from kivy.properties import (StringProperty, ListProperty, NumericProperty, DictProperty, 
BooleanProperty, ObjectProperty)
from kivy.clock import Clock
import math


class GameSystem(Widget):
    system_id = StringProperty('default_id')
    updateable = BooleanProperty(False)
    renderable = BooleanProperty(False)
    paused = BooleanProperty(False)
    active = BooleanProperty(True)
    gameworld = ObjectProperty(None)
    viewport = StringProperty('default_gameview')

    def __init__(self, **kwargs):
        super(GameSystem, self).__init__(**kwargs)
        self.entity_ids = list()

    def update(self, dt):
        pass

    def draw_entity(self, entity_id):
        pass

    def generate_component_data(self, entity_component_dict):
        #this is the load function
        return entity_component_dict
github nocarryr / rtlsdr-wwb-scanner / wwb_scanner / ui / kivyui / main.py View on Github external
def _deserialize(self, **kwargs):
        for key, data in kwargs.items():
            obj = getattr(self, key)
            obj.instance_from_json(data)



class RTLSDRScannerApp(App):
    def build(self):
        return RootWidget()
    def on_action_button_release(self, btn):
        btn.parent.parent.dismiss()
        Action.trigger_by_name(btn.action, self)

class PlotContainer(FloatLayout, JSONMixin):
    spectrum_graph = ObjectProperty(None)
    def add_plot(self, **kwargs):
        fn = kwargs.pop('filename', None)
        if fn is not None:
            kwargs.setdefault('name', os.path.basename(fn))
        plot = self.spectrum_graph.add_plot(**kwargs)
        self.tool_panel.add_plot(plot)
        return plot
    def _serialize(self):
        d = {'spectrum_graph':self.spectrum_graph._serialize()}
        return d
    def _deserialize(self, **kwargs):
        data = kwargs.get('spectrum_graph')
        self.spectrum_graph.instance_from_json(data)

class MessageDialog(BoxLayout):
    message = StringProperty()
github ODiogoSilva / TriFusion / TriFusion.py View on Github external
class InfoPopup(BoxLayout):
    cancel = ObjectProperty(None)


class MouseOverLabel(Button):
    pass


class RevConcDialog(BoxLayout):
    cancel = ObjectProperty(None)


class InputList(BoxLayout):
    cancel = ObjectProperty(None)


class BookmarkLabel(Label):
    pass


class SideLabel(Label):
    pass


class PathLabel(Label):
    pass


class PathText(AutoCompTextInput):
    pass