Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled MDButton fires on_press events if pos_hint defined #1687

Open
cdavidson-project-canary opened this issue Apr 19, 2024 · 1 comment
Labels
Status: Needs analysis Issue needs to be analyzed if it's real

Comments

@cdavidson-project-canary

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

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

@cdavidson-project-canary 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
@HeaTTheatR
Copy link
Member

#1633

@HeaTTheatR HeaTTheatR added the Status: Needs analysis Issue needs to be analyzed if it's real label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs analysis Issue needs to be analyzed if it's real
Projects
None yet
Development

No branches or pull requests

2 participants