Ver Fonte

#324 add documentation about updating options on choice elements

Falko Schindler há 2 anos atrás
pai
commit
a23528a4e2
3 ficheiros alterados com 9 adições e 0 exclusões
  1. 3 0
      nicegui/elements/radio.py
  2. 3 0
      nicegui/elements/select.py
  3. 3 0
      nicegui/elements/toggle.py

+ 3 - 0
nicegui/elements/radio.py

@@ -8,6 +8,9 @@ class Radio(ChoiceElement):
     def __init__(self, options: Union[List, Dict], *, value: Any = None, on_change: Optional[Callable] = None):
         """Radio Selection
 
+        The options can be specified as a list of values, or as a dictionary mapping values to labels.
+        After manipulating the options, call `update()` to update the options in the UI.
+
         :param options: a list ['value1', ...] or dictionary `{'value1':'label1', ...}` specifying the options
         :param value: the initial value
         :param on_change: callback to execute when selection changes

+ 3 - 0
nicegui/elements/select.py

@@ -9,6 +9,9 @@ class Select(ChoiceElement):
                  label: Optional[str] = None, value: Any = None, on_change: Optional[Callable] = None) -> None:
         """Dropdown Selection
 
+        The options can be specified as a list of values, or as a dictionary mapping values to labels.
+        After manipulating the options, call `update()` to update the options in the UI.
+
         :param options: a list ['value1', ...] or dictionary `{'value1':'label1', ...}` specifying the options
         :param value: the initial value
         :param on_change: callback to execute when selection changes

+ 3 - 0
nicegui/elements/toggle.py

@@ -8,6 +8,9 @@ class Toggle(ChoiceElement):
     def __init__(self, options: Union[List, Dict], *, value: Any = None, on_change: Optional[Callable] = None) -> None:
         """Toggle
 
+        The options can be specified as a list of values, or as a dictionary mapping values to labels.
+        After manipulating the options, call `update()` to update the options in the UI.
+
         :param options: a list ['value1', ...] or dictionary `{'value1':'label1', ...}` specifying the options
         :param value: the initial value
         :param on_change: callback to execute when selection changes