Kivy Removing Elements From A Stack- / Gridlayout
I made a pop-up. It is basically some rows of options (max. 5 rows). If I press the '+' button, there will be a new line of options. If I press the '-' button the last row should d
Solution 1:
Get the widget, and remove it.
An example of that:
from kivy.app import App
from kivy.lang import Builder
root = Builder.load_string('''
BoxLayout:
GridLayout:
id: grid
cols: 1
rows: 5
Label:
text: "label 1"
Label:
text: "label 2"
Label:
text: "label 3"
Label:
text: "label 4"
Button:
text: "Remove last item"
on_release: grid.remove_widget(grid.children[0])
''')
class MyApp(App):
def build(self):
return root
MyApp().run()
Post a Comment for "Kivy Removing Elements From A Stack- / Gridlayout"