from otree.api import * doc = """ All you need is a participant field called 'progress' then keep adding 1 to it. """ class Constants(BaseConstants): name_in_url = 'progress_bar' players_per_group = None num_rounds = 5 progress_template = __name__ + '/progress.html' class Subsession(BaseSubsession): pass def creating_session(subsession: Subsession): for player in subsession.get_players(): participant = player.participant participant.progress = 1 class Group(BaseGroup): pass class Player(BasePlayer): pass class Page1(Page): @staticmethod def before_next_page(player: Player, timeout_happened): participant = player.participant # remember to add 'progress' to PARTICIPANT_FIELDS. participant.progress += 1 class Page2(Page): @staticmethod def before_next_page(player: Player, timeout_happened): participant = player.participant # progress can be defined in different ways, not only by page number # (especially if pages get skipped) # so feel free to do things like: # - incrementing by more than 1: # participant.progress += 2 # - setting to a specific value: # participant.progress = 8 participant.progress += 1 page_sequence = [Page1, Page2]