slider event list

1,258 views
Skip to first unread message

Baptiste Pernet Mugnier

unread,
Apr 3, 2013, 10:51:49 AM4/3/13
to kivy-...@googlegroups.com
Hello,

I am looking for the list of events that can be bound to a Slider: http://kivy.org/docs/api-kivy.uix.slider.html. Where can I find this information ?

Regards,
Baptiste

Gabriel Pettier

unread,
Apr 3, 2013, 11:22:54 AM4/3/13
to kivy-...@googlegroups.com
You can bind to the change of any property, as everywhere in kivy,
attributes of classes are in fact properties, and that implement the
observer pattern, which mean they create events when they change.

If you want to bind to value:

Slider:
on_value: some_callback()

or on the change of the cursor position:

Slider:
on_value_pos: some_callback()

Also, as Slider inherit from Widget, you can bind to attributes of
Widget too:

Slider:
on_pos: some_callback()
on_size: some_callback()
on_opacity: some_other_callback()

and so on with all properties.

Some widgets have additional events, that doesn't come from properties,
like Popup (http://kivy.org/docs/api-kivy.uix.popup.html), you can see
them listed in the "Events" section of the class
(http://kivy.org/docs/api-kivy.uix.popup.html#kivy.uix.popup.Popup).

Hope this helps.
> --
> You received this message because you are subscribed to the Google Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

com...@motaj.com

unread,
Apr 4, 2013, 8:00:35 PM4/4/13
to kivy-...@googlegroups.com
One thing I noticed is that when you bind using python (i.e. not through .kv), you need to remove the preceding 'on_' from the property. For example:

In kv lang one would do:
 
on_pos: some_callback()

whereas in python you need:

slider.bind(pos=some_callback())

This wasn't very clear to me initially because I never came across this difference in the kivy docs (or I may have completely missed it, which is quite possible). 

Reply all
Reply to author
Forward
0 new messages