oTree Hub
Studio
Heroku
Forum
Public projects
Featured
Example code
otree-snippets
Links
Demo
Browse source code
Download
Author
Chris @ oTree
Description
Recipes for common tasks in oTree
Apps
appcopy1
appcopy2
are_you_sure
'Are you sure?' popup based on the user's input
audio_alert
Audio alert (speak some text to get the participant's attention, after a wait page)
back_button
Back button for multiple instructions pages
balance_treatments_for_dropouts
bmi_calculator
Basic single-player game (BMI calculator)
chat_from_scratch
Of course oTree has a readymade chat widget described here: https://otree.readthedocs.io/en/late...
complex_form_layout
comprehension_test_complex
Comprehension test. If the user fails too many times, they exit.
comprehension_test_simple
Simple version of comprehension test
configurable_players_per_group
Configurable players per group. See here: https://otree.readthedocs.io/en/latest/treatments.html#...
constant_sum
count_button_clicks
Count button clicks
css
Using CSS to style timer and chat box.
custom_export_groups
custom_export: 1 row for each group
detect_mobile
Detect and block mobile browsers
dropout_detection
Dropout detection (if user does not submit page in time)
dropout_end_game
Dropout detection for multiplayer game (end the game)
experimenter_input
Experimenter input during the experiment, e.g. entering the result of a random draw. If you want...
factorial_treatments
Randomize multiple factors in a balanced way
gbat_fallback_smaller_group_part0
gbat_fallback_smaller_group_part1
group_by_arrival_time: fall back to a smaller group if not enough people show up
gbat_fallback_solo_task_part0
gbat_fallback_solo_task_part1
group_by_arrival_time timeout (continue with solo task)
gbat_fallback_solo_task_part2
gbat_keep_same_groups_part0
gbat_keep_same_groups_part1
gbat_keep_same_groups_part2
Preserve same groups as a previous app that used group_by_arrival time.
gbat_new_partners
group by arrival time, but in each round assign to a new partner.
gbat_treatments
Conventionally, group-level treatments are assigned in creating_session: for g in subsession.get...
gbat_treatments_complex
Similar to the basic gbat_treatments app, except: - Treatments are balanced rather than indepen...
getattr_setattr
Using getattr() and setattr() to access numbered fields, e.g. player.num1, player.num2, ..., pla...
groups_csv
Reads groups from a CSV file. Inside this app, you will find a groups6.csv, which defines the gro...
history_table
History table
image_choices
Images in radio button choices
input_calculation
live_volunteer
Live volunteer's dilemma (first player to click moves everyone forward).
longitudinal
Longitudinal study (2-part study taking place across days/weeks) Another way to do longitudinal ...
min_time_on_page
Minimum time on a page
multi_language
How to translate an app to multiple languages (e.g. English and German). There are 2 ways to def...
multi_page_timeout
Timeout spanning multiple pages
multi_select
Question that lets you select multiple options (multi-select, multiple choice / multiple answer)
multi_select_complex
Question that lets you select multiple options (multi-select, multiple choice / multiple answer) ...
other_player_previous_rounds
Showing other players' decisions from previous rounds
pass_data_between_apps_part1
pass_data_between_apps_part2
pay_random_app3
App where we choose the app to be paid
pay_random_app_multi_player
pay_random_app_single_player
""" class C(BaseConstants): NAME_IN_URL = 'pay_random_app2' PLAYERS_PER_GROUP = None ...
pay_random_round
Select a random round for payment
persist_raw
Sliders and checkboxes that don't get wiped out on form reload. Also works for text/number inputs...
placeholder
practice_rounds
Practice rounds
progress_bar
All you need is a participant field called 'progress' then keep adding 1 to it.
questions_from_csv_complex
Read quiz questions from a CSV (complex version). See also the 'simple' version. It would be much...
questions_from_csv_simple
Read quiz questions from a CSV (simple version). See also the 'complex' version of this app.
question_with_other_option
Menu with an 'other' option that lets you type in a valueInput manually
quiz_with_explanation
Quiz with explanation. Re-display the previous page's form as read-only, with answers/explanation.
radio
Radio buttons in various layouts, looping over radio choices
radio_switching_point
Table where each row has a left/right choice, like the strategy method. This app enforces a singl...
random_num_rounds
random_num_rounds_multiplayer
Random number of rounds for multiplayer (random stopping rule)
random_num_rounds_multiplayer_end
random_question_order
random_task_order
For each participant, randomize the order of tasks A, B, and C. Task B has 2 pages, which are alw...
rank_players
Rank players
rank_topN
Ranking your top N choices from a list of options.
rank_widget
"Widget to rank/reorder items". See http://sortablejs.github.io/Sortable/ for more examples.
redirect_to_other_website
save_wrong_answers
Store the history of invalid responses a user made.
sequential
Sequential game (asymmetric)
sequential_symmetric
Sequential / cascade game (symmetric). Also see "intergenerational" featured app.
show_other_players_payoffs
slider_graphic
An image that changes when you move a slider. If your image is a some kind of chart, it's better ...
slider_live_label
Slider with live updating label
supergames
Supergames consisting of multiple rounds each
timer_custom
Timer: replacing the default timer with your own
treatments_from_spreadsheet
Reading treatment parameters from a CSV spreadsheet
wait_for_specific_people
Wait only for specific people
wait_page_timeout
Timeout on a WaitPage (exit the experiment)
Last updated
2023-07-23
Note: To open an *.otreezip file, enter:
otree unzip YOUR-FILE.otreezip