Page Attributes and Methods#

Experiment, position, and identification (Page)#

exp

The ExperimentSession to which this member belongs.

experiment

The ExperimentSession to which this member belongs.

section

The member's parent section.

parent

Alias for section.

parent_name

Name of the parent section.

tree

A single string, indicating the member's position in the experiment.

uptree()

List of the parent section and the grandparent sections (recursive).

short_tree

Short version of tree, without the _root._content part that is the same for all members.

name

Unique name of the member.

tag

Alias for name, included under this name for backwards compatibility.

uid

Alias for name, included under this name for backwards compatibility.

Hooks for overloading (Page)#

custom_move()

Hook for defining a page's own movement behavior, executed every time a movement from the page takes place, before on_first_hide() and on_each_hide().

on_close()

Executed once, when the page is closed, before data saving.

on_each_hide()

Executed every time the page is hidden, before closing it and before saving data, but after executing on_first_hide().

on_each_show()

Executed every time the page is shown, after executing on_first_show().

on_exp_access()

Executed once, when the ExperimentSession becomes available to the page.

on_first_hide()

Executed once, when the page is hidden for the first time, before executing on_each_hide().

on_first_show()

Executed once, when the page is shown for the first time, before executing on_each_show().

Data and general utilities (Page)#

data

Returns a dict of data for all input elements on the page.

unlinked_data

Returns an empty dict for 'normal' pages and the input data for unlinked pages.

durations()

Iterates over the visit durations for this page.

first_duration()

Returns the duration of the last visit to this page in the current session in seconds.

last_duration()

Returns the duration of the last visit to this page in the current session in seconds.

has_been_shown

Returns True, if the page has been displayed in the ongoing experiment session.

must_be_shown

False, if the experiment tolerates skipping this page entirely.

should_be_shown

Boolean, indicating whether a page should be shown.

is_closed

Returns True, if the page is closed.

minimum_display_time

Minimal amount of time that a page must be displayed before participants can move forward.

title

Page title (str).

subtitle

Page subtitle (str).

showif()

Hook for controlling whether a page or section should be shown.

vargs

A dictionary of additional arguments passed on the class upon initialization.

Access to elements (Page)#

all_elements

Alias for elements.

all_input_elements

Alias for input_elements.

filled_input_elements

Dict of all input elements on this page with non-empty data attribute.

updated_elements

Returns a dict of all elements on the page that already have access to the experiment session.

Visual settings (Page)#

background_color

A color to be used for the background of this page.

fixed_width

Custom value for defining a fixed width of the page.

responsive_width

Custom values for definig the width of the page in percent of the screen width.

Development utilities (Page)#

These methods and attributes are most likely to be of interest to you only if you derive your own pages.

added_to_experiment(experiment)

Informs the member that it was added to an experiment session.

added_to_section(section)

Informs the member that it was added to a section.

append(*elements)

Appends a variable number of elements to the page.

prepare_web_widget()

Hook for computations for preparing a page for display.

save_data([level, sync])

Saves current experiment data.

visible(attr)

Returns the subset of members in the given attribute that should be shown.

instance_log

If True, the member will spawn a logger that can be configured individually for each instance