Supported by Supported by Advertisement

Label functions

class label

The label widget is a non-interactive string of text.

Example (OpenSesame script):

widget 0 0 1 1 label text='My text'

Example (Python):

from libopensesame import widgets
form = widgets.form(exp)
label = widgets.label(form, text='My text')
form.set_widget(label, (0,0))
form._exec()

function label.__init__(form, text=u'label', frame=False, center=True)

Constructor.

Arguments:

  • form -- The parent form.
    • Type: form

Keywords:

  • text -- The label text.
    • Type: str, unicode
    • Default: 'label'
  • frame -- Indicates whether a frame should be drawn around the widget.
    • Type: bool
    • Default: False
  • center -- Indicates wheth

function label.draw_frame(rect=None, style=u'normal')

Draws a simple frame around the widget.

Keywords:

  • rect -- A (left, top, width, height) tuple for the frame geometry or None to use the widget geometry.
    • Type: tuple, NoneType
    • Default: None
  • style -- A visual style. Should be 'normal', 'active', or 'light'.
    • Type: str, unicode
    • Default: 'normal'

function label.draw_text(text, html=True)

Draws text inside the widget.

Arguments:

  • text -- The text to draw.
    • Type: str, unicode

Keywords:

  • html -- Indicates whether HTML should be parsed.
    • Type: bool
    • Default: True

function label.on_mouse_click(pos)

Is called whenever the user clicks on the widget.

Arguments:

  • pos -- An (x, y) coordinates tuple.
    • Type: tuple

function label.render()

Draws the widget.

function label.set_rect(rect)

Sets the widget geometry.

Arguments:

  • rect -- A (left, top, width, height) tuple.
    • Type: tuple

function label.set_var(val, var=None)

Sets an experimental variable.

Arguments:

  • val -- A value.

Keywords:

  • var -- A variable name, or None to use widget default.
    • Type: str, unicode, NoneType
    • Default: None