Skip to content

Rect checkbox

RectCheckBox

Simple checkbox. :3 - easter egg 1.

Specific kwargs

Argument Type Description
on_toggle_function / on_toggle Callable / None callback function called when checkbox state is toggled(default is None).
toggled bool toggled state(default is False).
toggled_rect_scale / toggled_scale int / float scale factor of the internal active rectangle when toggled (default is 0.8).
checkbox_group / group CheckBoxGroup / None adds checkbox to the specified checkbox group (default is None).

Getters

Name ReturnType Description
toggled bool current toggled state.

Setters

Name Kwargs Description
toggled value: bool sets toggled state.

RectCheckBox is a subclass of: Widget

Use case

from nevu_ui import *
import pygame

pygame.init()

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

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

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

widget = RectCheckBox(50)

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 = "RectCheckBox example", backend = Backend.RayLib)

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

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

widget = RectCheckBox(50)

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