expyriment.io.TextMenu

class expyriment.io.TextMenu(heading, menu_items, width, position=None, text_size=None, gap=None, heading_font=None, text_font=None, background_colour=None, text_colour=None, heading_text_colour=None, select_background_colour=None, select_text_colour=None, select_frame_colour=None, select_frame_line_width=None, justification=None, scroll_menu=None, background_stimulus=None, mouse=None)[source]

A class implementing a text menu.

Methods

__init__(heading, menu_items, width, position=None, text_size=None, gap=None, heading_font=None, text_font=None, background_colour=None, text_colour=None, heading_text_colour=None, select_background_colour=None, select_text_colour=None, select_frame_colour=None, select_frame_line_width=None, justification=None, scroll_menu=None, background_stimulus=None, mouse=None)[source]

Create a text menu.

This creates a menu with items to be selected.

Parameters:

heading : str

menu heading

menu_items : str or list

list with menu items

width : int

width of the menu

position : (int, int), optional

text_size : int, optional

background_colour : (int, int, int), optional

background colour of the menu

gap : int, optional

size of gap (pixel) between heading and item list

heading_font : str, optional

font to be used for the heading

text_font : str, optional

font to be used for the text

text_colour : (int, int, int), optional

text colour of the items

heading_text_colour : (int, int, int), optional

text colour of the heading

select_background_colour : (int, int, int), optional

background colour of the currently selected item

select_text_colour : (int, int, int), optional

text colour of the currently selected item

select_frame_colour : (int, int, int), optional

colour of the frame around the selected item

select_frame_line_width : int, optional

line width of the frame around the selected item

justification : int, optional

text justification: 0 (left), 1 (center), 2 (right)

scroll_menu : int, optional

maximum length of a item list before a scroll menu will be display. If the parameter is 0 of False scroll menu will not be displayed

background_stimulus : visual expyriment stimulus, optional

The background stimulus is a second stimulus that will be presented together with the TextMenu. For both stimuli overlap TextMenu will appear on top of the background_stimulus

mouse : expyriment.io.Mouse object, optional

If a mouse object is given, the menu can also be controlled by the mouse

background_colour

Getter for background_colour

background_stimulus

Getter for background_stimulus

gap

Getter for gap

get(preselected_item=0)[source]

Present the menu and return the selected item.

Parameters:

preselected_item : int, optional

item that is preselected when showing menu

Returns:

selected : int

integer representing the selected item in the list

heading

Getter for heading

heading_text_colour

Getter for heading_text_colour

justification

Getter for justification

logging

Getter for logging.

menu_items

Getter for menu_items

position

Getter for position

scroll_menu

Getter for scroll_menu

select_background_colour

Getter for select_background_colour

select_frame_colour

Getter for select_frame_colour

select_frame_line_width

Getter for select_frame_line_width

select_text_colour

Getter for select_text_colour

set_logging(onoff)

Set logging of this object on or off

Parameters:

onoff : bool

set logging on (True) or off (False)

Notes

See also design.experiment.set_log_level fur further information about event logging.

text_colour

Getter for text_colour

text_size

Getter for text_size