NiceUtils/examples/auto_widgets.py
2025-01-07 09:30:24 -04:00

20 lines
524 B
Python

from niceUtils.widget_registry import widget_registry
from nicegui import ui
from dataclasses import dataclass
@dataclass
class ExampleDataclass:
integer: int = 42
float_: float = 3.14
string: str = 'Hello, World!'
boolean: bool = True
def example_function(integer: int, float_: float, string: str = "Hello World", boolean: bool = True):
print(integer, float_, string, boolean)
widget_registry.render_function(example_function)
# widget_registry.render_dataclass(ExampleDataclass)
ui.run(dark=None)