Nevu object
NevuObject
The fundamental base class for all UI components. Handles initialization, constants, styles, events, caching, updating, drawing, and cloning.
NevuObject is a subclass of: NevuCobject
Specific kwargs
| Argument |
Type |
Description |
size |
NvVector2 | list |
initial size of the object. |
style |
Style | str |
style configuration or style name. |
id |
str | None |
unique identifier (default is None). |
floating |
bool |
if True, the object is not affected by layout rules (default is False). |
single_instance |
bool |
if True, restricts to a single instance (default is False). |
events |
Events |
event manager for the object. |
z / depth |
int |
z-index for rendering order (default is 0). |
tooltip |
Tooltip | None |
tooltip object to display on hover (default is None). |
subtheme_role |
SubThemeRole |
role in the current subtheme (default is TERTIARY). |
animation_manager |
AnimationManager | None |
manager for animations (default is None). |
Methods
| Name |
Kwargs |
Description |
show |
None |
makes the object visible. |
hide |
None |
hides the object. |
activate |
None |
makes the object active (interactable). |
disactivate |
None |
makes the object inactive. |
subscribe |
event: NevuEvent |
adds a new event listener to the object. |
get_animation_value |
animation_type: AnimationType |
returns the current value of the specified animation. |
get_font_size |
override_size=None |
returns the calculated font size. |
get_font |
override_size=None |
returns the font object (Pygame or Raylib). |
get_rect |
None |
returns the absolute bounding rectangle. |
get_rect_static |
None |
returns the local bounding rectangle. |
update |
events: list | None = None |
updates logic, animations, and events. |
draw |
None |
draws the object. |
clone |
None |
returns a deep copy of the object. |
kill |
None |
destroys the object and removes it from the z-system. |
on_click / on_hover / on_keyup / on_unhover / on_scroll / on_change |
... |
user hooks to override for custom logic. |
Getters
| Name |
ReturnType |
Description |
visible |
bool |
current visibility state. |
active |
bool |
current activity state. |
hover_state |
HoverState |
current hover state. |
style |
Style |
current style object. |
tooltip |
Tooltip | None |
current tooltip object. |
max_borderradius |
float |
maximum possible border radius for the current size. |
wait_mode |
bool |
if True, initialization is deferred. |
Setters
| Name |
Kwargs |
Description |
visible |
value: bool |
sets visibility state. |
active |
value: bool |
sets activity state. |
hover_state |
value: HoverState |
sets hover state and triggers events. |
style |
style: Style |
sets a new style and triggers visual update. |
tooltip |
value: Tooltip | None |
sets a new tooltip and connects it to the master. |
wait_mode |
value: bool |
sets wait mode. |
Use case
from nevu_ui import *
nvobj = NevuObject()
Created with GGen v1.1.0 for nevu_ui v0.7.5