import kivy from kivy.app import App from kivy.uix.floatlayout import FloatLayoutfrom kivy.uix.slider import Slider
class MainApp(App): def build(self): layout = MyLayout(size_hint=(0.4,0.2))
slider = Slider( min=10, max=100) # create and add slider to MyLayout layout.add_widget(slider) return layout class MyLayout(FloatLayout): def __init__(self, **kwargs): super(MyLayout, self).__init__(**kwargs) def on_touch_down(self, touch): if self.collide_point(*touch.pos): print("hit") else: print("miss") app = MainApp()app.run()
When you overload the on_touch_down() you are ‘consuming’ the touch. You need to pass the touch along, so it can bubble to the other widgets. See: https://kivy.org/doc/stable/api-kivy.uix.widget.html?highlight=widget#widget-touch-event-bubbling
import kivy
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.slider import Slider
class MainApp(App):
def build(self):
layout = MyLayout(size_hint=(0.4, 0.2
))
slider = Slider(min=10, max=100) # create and add slider to MyLayout
layout.add_widget(slider)
return layout
class MyLayout(FloatLayout):
def __init__(self, **kwargs):
super(MyLayout, self).__init__(**kwargs)
def on_touch_down(self, touch):
if self.collide_point(*touch.pos):
print("hit")
else:
print("miss"
)
return super().on_touch_down(touch)
app = MainApp()
app.run()
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/90f723cc-86e4-4e69-b1ef-35de6bc62f1eo%40googlegroups.com.