Skip to content

Label

Label

A widget that displays text.

Specific kwargs

Argument Type Description
text str initial text.
words_indent bool if True, the text when overflows will be splitted into words(default is False).
on_text_change Callable / None callback function called when label text changes(default is None).

Getters

Name ReturnType Description
text str current text.

Setters

Name Kwargs Description
text value: str overwrites current text with a new one.

Label is a subclass of: Widget

Use case

from nevu_ui import *
import pygame

pygame.init()

window = Window((500, 500), title = "Label example")

menu = Menu(window, (100%vw, 100%vh))

layout = Grid([100%fillw, 100%fillh], x=3, y=3)

widget = Label("Text", (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 = "Label example", backend = Backend.RayLib)

menu = Menu(window, (100%vw, 100%vh))

layout = Grid([100%fillw, 100%fillh], x=3, y=3)

widget = Label("Text", (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