btn = Button(text=str(i), size_hint_y=None, height=40)
The callback that tshirtman wanted you to do is correct, only the bind()
call is wrong:
# syntax
# summary_label.bind(propname=callback)
summary_label.bind(texture_size=self._set_summary_height)
Then in the callback, it must be [1] not y:
def _set_summary_height(self, instance, size):
instance.height = size[1]
# same as:
# instance.height = instance.texture_size[1]
In addition, if the texture size is already set, and if no relayout
happen, then you already have the good value. Add that after the bind():
summary_label.height = summary_label.texture_size[0] if
summary_label.texture_size is not None else 100
On 23/04/2012 11:57, Craig McInnes wrote:
> I changed it to use:
> summary_label.bind(texture___size=self._set_summary_height)
> and the callback still isn't getting called.
>
> Perhaps it's to do with when I'm setting the callback?
> I'll try putting together a simple case. It'll either show me where I'm
> going wrong or I can give you a replication case.
>
> Thanks,
> -Craig
>
> On Mon, Apr 23, 2012 at 8:21 AM, Mathieu Virbel <txp...@gmail.com
> <mailto:txp...@gmail.com>> wrote:
>
> Hi,
>
> The callback that tshirtman wanted you to do is correct, only the
> bind() call is wrong:
>
> # syntax
> # summary_label.bind(propname=__callback)
>
> summary_label.bind(texture___size=self._set_summary_height)
> summary_label.bind(on_texture___size=self._set_summary_height)
> ...
> def _set_summary_height(self, instance, touch):
> print instance
> print touch
> # I'm sure this is wrong, the point is this callback never gets
> invoked
> instance.height = instance.texture_size.y
>
> but the callback never gets called.
> I also tried changing the font size and explicitly calling
> update_texture(), as per:
> http://kivy.org/docs/api-kivy.__uix.label.html#kivy.uix.label.__Label.texture