kivy button not responding

70 views
Skip to first unread message

John Emma

unread,
Oct 21, 2016, 11:36:06 AM10/21/16
to Kivy users support
hello i am new to kivy and have had issues several times with my buttons when i use them in a class where i have defined the on_touch down function but the moment i comment the on_touch down function then my buttons clicks pics up again , i really need help with this i cant just think straight and i haven't found a workaround it thanks and God bless

ZenCODE

unread,
Oct 21, 2016, 1:44:55 PM10/21/16
to Kivy users support
Post your code and we can show you how :-)

John Emma

unread,
Oct 25, 2016, 4:18:20 AM10/25/16
to kivy-...@googlegroups.com
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.button import Button,Label



class Platform(FloatLayout):
def __init__(self):
super(Platform, self).__init__()

self.but = Button(text = "push")
self.add_widget(self.but)
self.but.size_hint = None,None

def on_touch_down(self, touch):
pass


class T_App(App):
def build(self):
return Platform()


T_App().run()

On 21 October 2016 at 18:44, ZenCODE <zenkey....@gmail.com> wrote:
Post your code and we can show you how :-)

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/HH9SP3u3_xw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Emma

unread,
Oct 25, 2016, 4:44:48 AM10/25/16
to kivy-...@googlegroups.com
thats the code Zen and the interesting thing is my button becomes responsive when i comment the on_touch_down function, i was reading through the docs and i taught maybe there could be a workaround it like excluding the button from the touch event, i really would appreciate any help thank you 

Oon-Ee Ng

unread,
Oct 25, 2016, 10:44:50 AM10/25/16
to kivy-...@googlegroups.com
That's simple, read https://kivy.org/docs/api-kivy.uix.widget.html
specifically the part about Widget touch event bubbling.

You can return False in on_touch_down or return super(Platform,
self).on_touch_down(touch) (latter is preferred but not a big deal
when you're only inheriting from FloatLayout unless you're redefining
general widget touch behavior somewhere. Still a good habit IMO).
>>> kivy-users+...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>
> --
> 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.

John Emma

unread,
Oct 25, 2016, 11:30:40 AM10/25/16
to kivy-...@googlegroups.com
thanks a lot i would work on that


>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>
> --
> 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

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/HH9SP3u3_xw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kivy-users+unsubscribe@googlegroups.com.

John Emma

unread,
Oct 25, 2016, 11:41:17 AM10/25/16
to kivy-...@googlegroups.com
Thank you very much after reading through the docs https://kivy.org/docs/api-kivy.uix.widget.html i was able to make the button responsive specifically the part about Widget touch event bubbling as you have instructed now it works fine this is my new line of code

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.button import Button,Label



class Platform(FloatLayout):
    touch = True
    def __init__(self):
super(Platform, self).__init__()

self.but = Button(text = "push")
self.add_widget(self.but)
self.but.size_hint = None,None

def on_touch_down(self, touch):
        if self.touch == True:
return True
else:
return super(Platform, self).on_touch_down(touch)
def on_touch_up(self, touch):
self.touch = False


class T_App(App):
def build(self):
return Platform()


T_App().run()

Oon-Ee Ng

unread,
Oct 25, 2016, 11:48:24 PM10/25/16
to kivy-...@googlegroups.com
Glad to help. Good of you to post that you've solved it, as well as an
explanation of what worked, that's a useful attitude in the community.
Happy kivy-ing!
>>> >>> kivy-users+...@googlegroups.com.
>>> >>> For more options, visit https://groups.google.com/d/optout.
>>> >>
>>> >>
>>> >
>>> > --
>>> > 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/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Kivy users support" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/kivy-users/HH9SP3u3_xw/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> kivy-users+...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>
> --
> 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.
Reply all
Reply to author
Forward
0 new messages