From 297dad858cd01fedfccb51c4598467226e44ceb4 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 29 Sep 2012 13:37:40 +0200 Subject: [PATCH] boxlayout: ensure that any change of the size/size_hint/pos_hint will update the boxlayout. --- kivy/uix/boxlayout.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kivy/uix/boxlayout.py b/kivy/uix/boxlayout.py index 8f0f99c2f..b650a454f 100644 --- a/kivy/uix/boxlayout.py +++ b/kivy/uix/boxlayout.py @@ -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)