Widget
A base widget, only drawing is implemented.
Specific kwargs
| Argument |
Type |
Description |
inverted / alt |
bool |
swap borders and content colors(default is False). |
bg_variant |
bool |
use the primary color of theme variant instead of container(default is False). |
clickable |
bool |
can be visually clicked(default is False). |
hoverable |
bool |
can be visually hovered(default is False). |
invert_on_click |
bool |
toggle inversion state when clicked(default is False). |
inline |
bool |
if True, will request surface to be set manually. |
font_role |
PairColorRole |
font color role(default is INVERSE_SURFACE). |
draw_borders |
bool |
if False, renderer won`t draw borders(default is True). |
draw_content |
bool |
if False, renderer won`t draw content(default is True). |
ripple_effect |
bool |
enable ripple effect(RAYLIB only, default is True). |
animate_color_change |
bool |
animate color change(RAYLIB only, default is True). |
override_color |
tuple / None |
overrides widget's background color (default is None). |
subtheme_role |
SubThemeRole |
subtheme role for the widget (default is SubThemeRole.SECONDARY). |
Methods
| Name |
Kwargs |
Description |
clear_texture |
None |
clears texture, use only in SDL mode |
Getters
| Name |
ReturnType |
Description |
subtheme_border |
tuple |
returns the computed border color based on theme and state. |
subtheme_content |
tuple |
returns the computed background/content color based on theme and state. |
subtheme_font |
tuple |
returns the computed font color based on theme and state. |
Use case
from nevu_ui import *
import pygame
pygame.init()
window = Window((500, 500), title = "Widget example")
menu = Menu(window, (100%vw, 100%vh))
layout = Grid([100%fillw, 100%fillh], x=3, y=3)
widget = Widget(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 = "Widget example", backend = Backend.RayLib)
menu = Menu(window, (100%vw, 100%vh))
layout = Grid([100%fillw, 100%fillh], x=3, y=3)
widget = Widget(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