I can suggest you to use or bind your "update method" when a property
change, or defer loading.
When you need to do something on blocksize update:
class UITetris(Widget):
...
def on_blocksize(self, instance, value):
# put your things here
When you need to do something after multiple changes (clock trigger is a
good way)
class UITetris(Widget):
def __init__(self, **kwargs):
super(UITetris, self).__init__(**kwargs)
self._trigger_update =
Clock.create_trigger(self.my_update_func, 0)
self.bind(blocksize=self._trigger_update,
gamesize=self._trigger_update)
def my_update_func(self, *largs):
# put your things here, one or both blocksize/gamesize have
been updated
Or delayed initialization:
class UITetris(Widget):
def __init__(self, **kwargs):
super(UITetris, self).__init__(**kwargs)
Clock.schedule_once(self.late_init, 0)
def late_init(self, *largs):
# put your things here, it will be call one once before the
next frame.
The 3 methods have pro/cons, and can support different case. The second
one is the most robust i think.
Mathieu
Le 07/12/2011 16:24, sjinny a �crit :
> Le 07/12/2011 16:24, sjinny a �crit :
Le 07/12/2011 16:50, sjinny a �crit :
>> Le 07/12/2011 16:24, sjinny a �crit :