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(self.experiment)
label = widgets.label(form, text='My text')
form.set_widget(label, (0,0))
form._exec()
Function list:
- function label.__init__(form, text=u’label’, frame=False, center=True)
- function label.draw_frame(style=u’normal’, rect=None)
- function label.draw_text(text, html=True)
- function label.on_mouse_click(pos)
- function label.render()
- function label.set_rect(rect)
- function label.set_var(val, var=None)
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: u’label’
frame
– Indicates whether a frame should be drawn around the widget.- Type: bool
- Default: False
center
– Indicates whether the text should be centerd.- Type: bool
- Default: True
function label.draw_frame(style=u’normal’, rect=None)
Draws a simple frame around the widget.
Keywords:
rect
– A (left, top, width, height) tuple for the frame geometry orNone
to use the widget geometry.- Type: tuple, NoneType
- Default: None
style
– A visual style. Should be ‘normal’, ‘active’, or ‘light’.- Type: str, unicode
- Default: u’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