KivyMD icon indicating copy to clipboard operation
KivyMD copied to clipboard

MDButton receives touch events even in the disabled state

Open pyLover2050 opened this issue 5 months ago • 1 comments

Description of the Bug

The button functions like a normal button even when disabled, with the MDButtonText area not receiving touch events outside its area. Thus, the button still receives touch events and callbacks as if it were enabled.

Code and Logs

from kivymd.app import MDApp
from kivy.lang import Builder

KV = '''
MDBoxLayout:
    MDBoxLayout:
        size_hint_x: .5
    MDBoxLayout:
        size_hint_x: .5
        MDButton:
            disabled: True
            on_release: print('Button pressed!')
            MDButtonText:
                text: 'disabled'
'''

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

Screenshots

here is a video

https://github.com/kivymd/KivyMD/assets/113103699/d835455f-d03c-441c-8b9c-a4c914b72293

Versions

  • OS: Window
  • Python: 3.11.7
  • Kivy: v2.3.0
  • KivyMD: 2.0.1.dev0

pyLover2050 avatar Feb 06 '24 20:02 pyLover2050