HideOnForwardSection#
- class alfred3.section.HideOnForwardSection(title: Optional[str] = None, name: Optional[str] = None, shuffle: Optional[bool] = None, **kwargs)[source]#
Bases:
alfred3.section.Section
A section that hides pages once they have been submitted.
- Parameters
**kwargs –
Inherited keyword arguments
name (str)
Name of the member. Must be unique throughout the experiment. Can be defined as a class attribute. When you write a page or section in class style, the name can be inferred from the class name and does not need to be defined explicitly again. If a name is defined explicitly as a class attribute, that name is used.
shuffle (bool)
If True, the order of all members in this section will be randomized every time the section is entered. Shuffling is not recursive, it only affects direct members of a section. That means, if there are subsections, their position in the parent section will be randomized, but the members within the subsection will not be affected. Defaults to False. Can be defined as a class attribute.
subtitle (str)
Subtitle of the member. Can be defined as a class attribute.
title (str)
Title of the member. Can be defined as a class attribute.
vargs (dict)
A dictionary that can be used to pass additional arguments to the page. The arguments are then available as an instance attribute. As a special feature, the instance attribute allows you to access the values of the dictionary not only via the usual square-bracket notation, but also via dot-notation. This argument fulfills a similar function as
**kwargs
do sometimes, but it makes sure that user-defined additional arguments will not collide with inherited keywords arguments. Can be defined as a class attribute.
This section enables the following behaviors:
Once a participant has entered their data on a page and submitted it by pressing “forward”, the participant cannot revisit that page – it is hidden.
The participant can, however, go back to pages in previous sections. For instance, they may revisit the instructions page. A press on “forward” will then ignore the hidden pages and take the participant back to the most recent page.
New in version 2.3.0.
Examples
You can test the section’s behavior with this example:
import alfred3 as al exp = al.Experiment() main = al.Section(name="main") main += al.Page(name="first") hide = al.HideOnForwardSection(name="hide") hide += al.Page(name="second") hide += al.Page(name="thirs") exp += main exp += hide
Methods
Informs the member that it was added to an experiment session.
Informs the member that it was added to a section.
Appends a variable number of pages or subsections to the section.
Executed every time this section is entered.
Executed once, when the
ExperimentSession
becomes available to the section.Executed every time a direct subsection of this section is entered.
Executed every time this section is left.
Executed every time the experiment resumes from a direct subsection to this section.
Returns the position of this page or section inside its parent section, starting at 1.
Hook for controlling whether a page or section should be shown.
List of the parent section and the grandparent sections (recursive).
Called for validation on each backward move.
Called for validation on each forward move.
Called for validation on jumping from this section.
Validates pages and their input elements within the section.
Validates the current page and its elements.
Returns the subset of members in the given attribute that should be shown.
Attributes
Returns a flat dict of all closed pages in this section and its subsections.
Returns a flat dict of all elements in this section.
Returns a flat dict of all input elements in this section.
Returns a flat dict of all members in this section and its subsections.
Returns a flat dict of all pages in this section and its subsections.
Returns a flat dict of all shown input elements in this section.
Returns a flat dict of all pages in this section and its subsections that have already been shown.
Returns a flat dict of all sections in this section and its subsections.
Returns a dict of all elements in the current section that have access to the experiment session.
Returns a dict of all members that already have exp access.
Returns a dict of all pages in the current section that have access to the experiment session.
Controls, whether participants can move backward from and to pages in this section.
Controls, whether participants can move forward from pages in this section.
Controls, whether participants can jump from pages in this section
Controls, whether participants can jump to pages in this section.
If True, pages in this section will be closed on leaving
Returns a dictionary of user input data for all pages in this section and its subsections.
True, if there are no pages or subsections in this section.
The
ExperimentSession
to which this member belongs.The
ExperimentSession
to which this member belongs.Returns the first member of the current section.
Returns the first page inside the current section.
If True, the member will spawn a logger that can be configured individually for each instance
Returns the last member of the current section.
Returns the last page inside the current section.
Dictionary of the section's members.
Unique name of the member.
Returns a flat dict of all pages in this section.
Alias for
section
.Name of the parent section.
The member's parent section.
Short version of
tree
, without the_root._content
part that is the same for all members.Returns True if should_be_shown is set to True (default) and all showif conditions return True.
If True, the members of this section will be randomized every time the section is entered.
Returns a flat dict of all subsections in this section.
Page subtitle (str).
Alias for
name
, included under this name for backwards compatibility.Page title (str).
A single string, indicating the member's position in the experiment.
Alias for
name
, included under this name for backwards compatibility.Returns a dictionary of user input data for all unlinked pages in this section and its subsections.
A dictionary of additional arguments passed on the class upon initialization.