How to use the flexx.flx.Button 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 flexxui / flexx / flexxamples / testers / minsize.py View on Github external
def init(self):
        super().init()

        with flx.VBox():

            flx.Label(text='You should see 5 pairs of buttons')

            with flx.HFix():  # Use minsize in CSS of button widget
                with flx.GroupWidget(title='asdas'):
                    with flx.HFix():
                        flx.Button(text='foo')
                        flx.Button(text='bar')

            with flx.HFix(minsize=50):  # Set minsize prop on container
                flx.Button(text='foo')
                flx.Button(text='bar')

            with flx.HFix():  # Set minsize prop on widget
                flx.Button(text='foo', minsize=50)
                flx.Button(text='bar')

            with flx.HFix():  # Old school setting of style
                flx.Button(text='foo', style='min-height:50px;')
                flx.Button(text='bar', )

            with flx.Widget():  # Singleton widgets (e.g. custom classes)
                with flx.HFix():
                    flx.Button(text='foo')
                    flx.Button(text='bar')

            flx.Widget(flex=1, style='background:#f99;')  # spacer
github flexxui / flexx / flexxamples / howtos / redirect.py View on Github external
def init(self):
        self.but1 = flx.Button(text='Redirect')
        self.but2 = flx.Button(text='Open new page')
github nilsbore / flexxros / src / flexxros / rosmon.py View on Github external
def init(self, topic):

        self.server_name = topic.split("/")[1]
        self.service_name = "/" + self.server_name + "/start_stop"

        self.nodes = {}
        self.subscribe(topic, "rosmon_msgs/State", self.callback)
        self.list_container = flx.VBox(flex=1)
        with self.list_container:
            with flx.HBox(flex=1):
                self.expand = flx.Button(flex=0, text=">")
                self.label = flx.Label(flex=0, text=self.server_name + ":")
                self.launch_state = flx.Label(flex=0, text="IDLE", style='color: #F00;')
                #self.expand = flx.Button(text="Expand")
                flx.Widget(flex=1)
                self.start_stop = flx.Button(flex=0, text="Stop")
            self.base_layout = flx.VBox(flex=1, style='border:1px solid #777;')
            with self.base_layout:
                with flx.HFix():
                    flx.Label(text="Name")
                    flx.Label(text="State")
                    flx.Label(text="CPU")
                    flx.Label(text="Memory")
                    flx.Label(text="Restarts")
                    flx.Label(text="Action")
        self.base_layout.set_parent(None)
github nilsbore / flexxros / scripts / service_example.py View on Github external
def init(self):
        with flx.FormLayout(flex=1, maxsize=400):
            self.type_message = flx.CheckBox(title="Checked?")
            self.send_message = flx.Button(text="Request service")
            self.receive_message = flx.Label(title="Response:", text="Waiting for response...")
github flexxui / flexx / flexxamples / demos / themed_form.py View on Github external
def init(self):

        with flx.HFix():
            with flx.FormLayout() as self.form:
                self.b1 = flx.LineEdit(title='Name:', text='Hola')
                self.b2 = flx.LineEdit(title='Age:', text='Hello world')
                self.b3 = flx.LineEdit(title='Favorite color:', text='Foo bar')
                flx.Button(text='Submit')
            with flx.FormLayout() as self.form:
                self.b4 = flx.LineEdit(title='Name:', text='Hola')
                self.b5 = flx.LineEdit(title='Age:', text='Hello world')
                self.b6 = flx.LineEdit(title='Favorite color:', text='Foo bar')
                flx.Button(text='Submit')
                flx.Widget(flex=1)  # Add a spacer
github flexxui / flexx / flexxamples / demos / chatroom.py View on Github external
def init(self):
        with flx.HBox(title='Flexx chatroom demo'):
            flx.Widget(flex=1)
            with flx.VBox():
                self.name_edit = flx.LineEdit(placeholder_text='your name')
                self.people_label = flx.Label(flex=1, minsize=250)
            with flx.VBox(minsize=450):
                self.messages = MessageBox(flex=1)
                with flx.HBox():
                    self.msg_edit = flx.LineEdit(flex=1,
                                                 placeholder_text='enter message')
                    self.ok = flx.Button(text='Send')
            flx.Widget(flex=1)

        self._update_participants()
github flexxui / flexx / flexxamples / howtos / openlayers.py View on Github external
def init(self):
        self.set_title("Openlayers example")
        with flx.VBox():
            with flx.HBox():
                self.map = Ol(flex=1)
                self.btn = flx.Button(text="", disabled=True)
                with flx.VBox():
                    self.btnosm = flx.Button(text='Load Openstreetmap')
                    self.btna = flx.Button(text='Load GEOJSON')
                    self.btnr = flx.Button(text='Remove GEOJSON')
                    self.btndraw = flx.Button(text='Draw Points')
                    self.btn_stop_draw = flx.Button(text='Stop Drawing')
                    flx.Widget(flex=1)
            self.coords = flx.Label(flex=1)
github flexxui / flexx / flexxamples / howtos / openlayers.py View on Github external
def init(self):
        self.set_title("Openlayers example")
        with flx.VBox():
            with flx.HBox():
                self.map = Ol(flex=1)
                self.btn = flx.Button(text="", disabled=True)
                with flx.VBox():
                    self.btnosm = flx.Button(text='Load Openstreetmap')
                    self.btna = flx.Button(text='Load GEOJSON')
                    self.btnr = flx.Button(text='Remove GEOJSON')
                    self.btndraw = flx.Button(text='Draw Points')
                    self.btn_stop_draw = flx.Button(text='Stop Drawing')
                    flx.Widget(flex=1)
            self.coords = flx.Label(flex=1)
github nilsbore / flexxros / src / flexxros / widgets.py View on Github external
for c in ev:
                for child in self.vbox.children:
                    print(child.title, child.text)
                    if child.title == c:
                        child.set_text(str(ev[c]))
                        break
            return

        print("Event: ", ev)

        with self.vbox:
            for c in ev:
                if c in ["groups", "type", "source"]:
                    continue
                l = flx.LineEdit(title=c, text=str(ev[c]))
            flx.Button(text="Set")
            flx.Widget(minsize=60)

        self.is_init = True