Label¶
from flexx import app, event, ui
class Example(ui.Widget):
def init(self):
with ui.HBox():
self.but = ui.Button(text='Push me')
self.label = ui.Label(flex=1, wrap=True, text='This is a label. ')
@event.reaction('but.pointer_down')
def _add_label_text(self, *events):
self.label.set_text(self.label.text + 'Yes it is. ')
-
class
flexx.ui.
Label
(*init_args, **kwargs)¶ Inherits from:
Widget
Widget to show text/html.
The
node
of this widget is a <div> with CSSword-wrap
andwhite-space
set appropriately.actions: set_html, set_text, set_wrap
-
html
¶ StringProp – The html shown in the label.
Warning: there is a risk of introducing openings for XSS attacks when html is introduced that you do not control (e.g. from user input).
-
set_html
(html)¶ action – Setter for the html property. Use with care.
-
set_text
(text)¶ action – Setter for the text property.
-
set_wrap
(*val)¶ action – Setter for the ‘wrap’ property.
-
text
¶ StringProp – The text shown in the label (HTML is shown verbatim).
-
wrap
¶ IntProp – Whether the content is allowed to be wrapped on multiple lines. Set to 0/False for no wrap (default), 1/True for word-wrap, 2 for character wrap.
-