Ver Fonte

documentation for group.clear() method

Falko Schindler há 3 anos atrás
pai
commit
4fa6f98b02
2 ficheiros alterados com 16 adições e 1 exclusões
  1. 15 0
      main.py
  2. 1 1
      nicegui/elements/column.py

+ 15 - 0
main.py

@@ -295,6 +295,21 @@ with example(ui.row):
         ui.label('label 2')
         ui.label('label 3')
 
+clear = '''### Clear Containers
+
+To remove all elements from a row, column or card container, use the `clear()` method.
+'''
+with example(clear):
+    container = ui.row()
+
+    def add_face():
+        with container:
+            ui.icon('face')
+    add_face()
+
+    ui.button('Add', on_click=add_face)
+    ui.button('Clear', on_click=container.clear)
+
 binding = '''### Bindings
 
 With help of the [binding](https://pypi.org/project/binding/) package NiceGUI is able to directly bind UI elements to models.

+ 1 - 1
nicegui/elements/column.py

@@ -4,7 +4,7 @@ from .group import Group
 class Column(Group):
 
     def __init__(self):
-        '''Row Element
+        '''Column Element
 
         Provides a container which arranges its child in a row.
         '''