ui.bar - Ren'Py Visual Novel Engine

documentation index ◦ reference manual ◦ function index

# ui.bar

Function: | ui.bar | (range=None, value=None, changed=None, step=None, page=None, adjustment=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.

adjustment - This should always be given as a keyword argument. If not none, it should be a ui.adjustment that is to used by this bar, and the following arguments are ignored. If None, a new ui.adjustment is created from the range, value, changed, step, and page arguments.

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:
         ui.vbox()

         ui.hbox()
         ui.text("Non-adjustable bar: ")
         ui.bar(100, 75)
         ui.close()

         ui.hbox()
         ui.text("Adjustable bar: ")
         adj = ui.adjustment(100, 50, adjustable=True)
         ui.bar(adjustment=adj)
         ui.close()

         ui.textbutton("Done", clicked=ui.returns(True))
         ui.interact()

         value = adj.value

documentation index ◦ reference manual ◦ function index