How to use the flexx.event.connect function in flexx

To help you get started, we’ve selected a few flexx 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 AB-CE / abce / abcEconomics / gui / form.py View on Github external
        @event.connect('save.mouse_click')
        def _save(self, events):
            parameter = self.parse_parameter()
            parameter['name'] = self.name.text
            parameter['description'] = self.description.text
            abcEconomics.parameter_database.upsert(parameter, keys=['name'])
            self.emit('update_parameter_database', parameter)
github flexxui / flexx / exp / editor.py View on Github external
        @event.connect('size', 'font_size')
        def update(self, *events):
            
            ctx = self.ctx
            w, h = self.size
            
            # Enable hidpi
            ratio = self.dpratio / self.bsratio
            self.node.width = w * ratio
            self.node.height = h * ratio
            
            ctx.clearRect(0, 0, w, h)
            ctx.font = "%ipx DejaVu Sans Mono" % self.font_size
            
            cw = ctx.measureText('x').width
            ch = self._measure_text_height()
github flexxui / flexx / flexx / ui / widgets / _html.py View on Github external
        @event.connect('text')
        def __on_inner_html(self, *events):
            self.node.innerHTML = events[-1].new_value
github flexxui / flexx / flexx / app / examples / parent_children.py View on Github external
        @event.connect('parent')
        def on_parent(self, *events):
            parent = events[-1].new_value
            parent_id = 'None' if parent is None else parent._id
            print('parent of %s changed to %s in JS' % (self._id, parent_id))
github flexxui / flexx / flexx / event / tmp.py View on Github external
    @event.connect('result')
    def show_result(self, *events):
        """ handler to show result. Can be called at any time. """
        if self.result:
            print('The result is', self.result)
github flexxui / flexx / flexx / ui / layouts / _grid.py View on Github external
        @event.connect('children', 'children*.pos',
                       'children*.flex', 'children*.base_size')
        def __update_positions(self, *events):
            self._child_limits_changed()
github flexxui / flexx / flexx / event / examples / greeter.py View on Github external
    @event.connect('first_name', 'last_name')
    def greet1(self, *events):
        print('Hello %s %s' % (self.first_name, self.last_name))
github AB-CE / abce / abcEconomics / gui / bokehwidget.py View on Github external
        @event.connect('_plot_components')
        def __set_plot_components(self, *events):
            ev = events[-1]
            self.node.innerHTML = ev.div
            el = window.document.createElement('script')
            el.innerHTML = ev.script
            self.node.appendChild(el)

            def getplot():
                # Get plot from id in next event-loop iter
                self.plot = Bokeh.index[ev.id]
                canvas = self.plot.plot_canvas_view
                canvas.reset_dimensions()

            window.setTimeout(getplot, 100)
github AB-CE / abce / abcEconomics / gui / bokehwidget.py View on Github external
        @event.connect('size')
        def __resize_plot(self, *events):
            if self.plot and self.parent:
                self.plot.resize()
github flexxui / flexx / flexx / app / examples / init_order1.py View on Github external
    @event.connect('foo')
    def on_foo(self, *events):
        for ev in events:
            print('Py: handling %s event' % ev.type, self.foo + self.spam)