Button

Screenshot

Button - Reference - Enaml-native - CodeLV

Example

from enamlnative.core.api import *
from enamlnative.widgets.api import *
from enamlnative.android.app import AndroidApplication

enamldef ContentView(FrameLayout):
    attr app = AndroidApplication.instance()
    Flexbox:
        flex_direction = "column"
        Button:
            text = "default"
            text_color = "#f00"
            font_family = "sans-serif-light"
            align_self = 'flex_end'
            text_size = 32
            clicked :: app.show_toast("Clicked {}".format(self.text))
        Button:
            text = "flat"
            flat = True
            text_color = "#c1a"
            align_self = 'flex_start'
            clicked :: app.show_toast("Clicked {}".format(self.text))
        ToggleButton:
            text = "Initial"
            text_on = "It's on!"
            text_off = "Awwff"
            min_width = 400
            max_width = 500
            align_self = 'center'
            clicked :: app.show_toast("State {}".format(self.checked))
    FloatingActionButton:
        gravity = "bottom|right"
        margin = (0, 0, 10, 10)
        src = "{md-play-arrow}"
        clicked :: app.show_toast("Play clicked!")

Declaration

class enamlnative.widgets.button.Button(parent=None, **kwargs)[source]

Bases: enamlnative.widgets.text_view.TextView

A simple control for displaying a button.

clickable

Button is clickable by default

flat

Use a flat style

proxy

A reference to the proxy object.

Android Implementation

class enamlnative.android.android_button.AndroidButton[source]

Bases: enamlnative.android.android_text_view.AndroidTextView, enamlnative.widgets.button.ProxyButton

An Android implementation of an Enaml ProxyButton.

widget

A reference to the widget created by the proxy.

create_widget()[source]

Create the underlying widget.

init_widget()[source]

Initialize the underlying widget.

No iOS implementation found.