Slider bar
Slider
Complex widget containing ProgressBar with possibility to drag it.
Specific kwargs
| Argument |
Type |
Description |
start_value / start |
int / float |
starting value(default is 0). |
end_value / end |
int / float |
ending value(default is 100). |
current_value / current |
int / float |
current value(default is 0). |
step |
int / float |
step to change value(default is 1). |
bar_style |
Style / None |
progress bar style(default is None). |
padding_x / pad_x |
int |
text x padding in pixels(default is 10). |
padding_y / pad_y |
int |
text y padding in pixels(default is 10). |
bar_font_role |
TupleColorRole |
color role for the text(default is INVERSE_PRIMARY). |
filled_rect_role / role |
PairColorRole |
color role for the progress bar(default is BACKGROUND). |
Methods
| Name |
Kwargs |
Description |
create_progress_bar |
None |
initializes the internal ProgressBar widget. |
adjust_text_rect |
rect: NvRect | None = None |
returns or updates coordinates of the value text inside boundaries. |
Getters
| Name |
ReturnType |
Description |
current_value |
int / float |
current value of the slider. |
Setters
| Name |
Kwargs |
Description |
current_value |
value: int / float |
sets current value of the slider. |
Use case
from nevu_ui import *
import pygame
pygame.init()
window = Window((500, 500), title = "Slider example")
menu = Menu(window, (100%vw, 100%vh))
layout = Grid([100%fillw, 100%fillh], x=3, y=3)
widget = Slider(size = (100, 100))
layout.add_item(widget, 2, 2)
menu.layout = layout
while True:
window.begin_frame()
window.update()
menu.update()
menu.draw()
window.end_frame()
from nevu_ui import *
import pyray
window = Window((500, 500), title = "Slider example", backend = Backend.RayLib)
menu = Menu(window, (100%vw, 100%vh))
layout = Grid([100%fillw, 100%fillh], x=3, y=3)
widget = Slider(size = (100, 100))
layout.add_item(widget, 2, 2)
menu.layout = layout
while True:
window.begin_frame()
window.update()
menu.update()
menu.draw()
window.end_frame()
Created with GGen v1.3.0 for nevu_ui v0.8.2