boxlayout: ensure that any change of the size/size_hint/pos_hint will update the boxlayout.

This commit is contained in:
Mathieu Virbel 2012-09-29 13:37:40 +02:00
parent cfb118cccf
commit 297dad858c
1 changed files with 14 additions and 0 deletions

View File

@ -190,3 +190,17 @@ class BoxLayout(Layout):
c.width = w
c.height = h
y += h + spacing
def add_widget(self, widget, index=0):
widget.bind(
size=self._trigger_layout,
size_hint=self._trigger_layout,
pos_hint=self._trigger_layout)
return super(Layout, self).add_widget(widget, index)
def remove_widget(self, widget):
widget.unbind(
size=self._trigger_layout,
size_hint=self._trigger_layout,
pos_hint=self._trigger_layout)
return super(Layout, self).remove_widget(widget)