Reference Manual: (offline | online) Quickstart: (offline | online)

# ui.bar

Function: ui.bar( | range, value, changed=None, style='bar', **properties)

This creates a bar widget. The bar widget can be used to display data in a bar graph format, and optionally to report when the user clicks on a location in that bar.

range - The range of values this bar can undertake. The bar is completely full when its value is this number.

value - The value of this bar. It must be between 0 and range, inclusive.

changed - This is a callback function called when the mouse is clicked in this widget. It is called with a single argument, which is the value corresponding to the location at which the mouse button was clicked. This argument is an integer if range is an integer, and a float if range is a float. If this function returns a value, that value is returned from ui.interact .

style - The style of this bar. As of 6.2.0, there are four styles that you can use:

- bar - A horizontal bar, with the largest value to the right.

- scrollbar - A horizontal scrollbar, with the largest value to the right.

- vbar - A vertical bar, with the largest value to the top.

- vscrollbar - A vertical scrollbar, with the largest value to the bottom.

The width and height should be set with the xmaximum and ymaximum properties. For best results, if clicked is set then width should be at least twice as big as range.

## Example

    python:
        # Stats Window
        ui.frame(xpos=0,
                 ypos=0,
                 xanchor='left',
                 yanchor='top',
                 xfill=True,
                 )

        ui.vbox()

        ui.text('Statistics')
        ui.null(height=20)

        for name, range, value in stats:
            ui.hbox()
            ui.text(name, minwidth=150)
            ui.bar(range, value, ypos=0.5, yanchor='center')
            ui.close() # for the ui.hbox

        ui.close() # for the ui.vbox

Reference Manual: (offline | online) Quickstart: (offline | online)