You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
fromkivy.clockimportmainthreadfromkivymd.appimportMDAppfromkivymd.uix.buttonimportMDButton, MDButtonTextfromkivymd.uix.screenimportMDScreenclassTestApp(MDApp):
defbuild(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 occurdisabled=True
)
screen.add_widget(self.button)
self.button.bind(on_press=lambdax: self.on_button_press())
returnscreen#defon_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
The text was updated successfully, but these errors were encountered:
cdavidson-project-canary
changed the title
Disabled MDButton files on_press events if pos_hint defined
Disabled MDButton fires on_press events if pos_hint defined
Apr 19, 2024
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
The text was updated successfully, but these errors were encountered: