KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications. https://youtube.com/c/KivyMD https://twitter.com/KivyMD https://habr.com/ru/users/kivymd https://stackoverflow.com/tags/kivymd
A MDButton that is disabled will fire on_press events/callbacks if a pos_hint is applied to the button. The on_press events disappear when the pos_hint is removed.
Code and Logs
from kivy.clock import mainthread
from kivymd.app import MDApp
from kivymd.uix.button import MDButton, MDButtonText
from kivymd.uix.screen import MDScreen
class TestApp(MDApp):
def build(self):
screen = MDScreen()
self.button = MDButton(
pos_hint = {"center_x": 0.5, "center_y": 0.5}, # comment out this line and on_press events won't occur
disabled = True
)
screen.add_widget(self.button)
self.button.bind(on_press=lambda x: self.on_button_press())
return screen
#
def on_button_press(self):
print("button pressed")
#
#
app = TestApp()
app.run()
Versions
OS: Windows 11 Enterprise
Python: 3.10.11
Kivy: 2.3.0
KivyMD: 2.0.1.dev0
Description of the Bug
A MDButton that is disabled will fire on_press events/callbacks if a pos_hint is applied to the button. The on_press events disappear when the pos_hint is removed.
Code and Logs
Versions
OS: Windows 11 Enterprise Python: 3.10.11 Kivy: 2.3.0 KivyMD: 2.0.1.dev0