documentation index ◦ reference manual ◦ function index

# ui.autobar

Function: | ui.autobar | (range, start, end, time, **properties):

Creates a bar (with a range of range) that automatically moves from start to end in time seconds.

    # Shows a bar at the top of the screen that automatically tracks the score variable, animating as it does.

    init python:
        def overlay():
            global old_score

            ui.hbox()
            ui.text("Score: ")
            ui.autobar(100, old_score, score, 1.0)
            ui.close()

            old_score = score

        config.overlay_functions.append(overlay)

    label start:
        $ score = old_score = 0

        "You have zero points."

        $ score += 10

        "Now you have ten more points."

documentation index ◦ reference manual ◦ function index