Search code examples
python-3.xkivykivymd

Cannot release button in KivyMD


Why does the following code not release it when I touch the center of the button?

If I touch the bottom of the button, I can release it, so I guess there is probably a problem with the coordinate calculation.

from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivymd.app import MDApp
from kivymd.uix.tab import MDTabsBase

kv = '''
MDBottomNavigation:
    MDBottomNavigationItem:
        MDTabs:
            MyTab:
                title: 'tab'
                ScrollView:
                    MDRectangleFlatButton:
                        id: button
                        text: self.state
                        font_size: 60
'''


class MyTab(FloatLayout, MDTabsBase):
    pass


class MyApp(MDApp):
    def build(self):
        return Builder.load_string(kv)


MyApp().run()

  • python 3.8
  • Kivy 2.1.0
  • kivymd 1.1.1

Solution

  • There was a problem with _do_touch_up, an internal function of Carousel in Kivy.

    It's necessary to write touch.apply_transform_2d(self.to_widget) and the associated push() and pop() in this function.