OpenSesame videos
Python videos

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))

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



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


  • 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.


  • 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.


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


  • 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.


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

function label.render()

Draws the widget.

function label.set_rect(rect)

Sets the widget geometry.


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

function label.set_var(val, var=None)

Sets an experimental variable.


  • val -- A value.


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