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

Kivy basic button program doesnt work #1199

Closed
matanix opened this issue Dec 18, 2017 · 1 comment
Closed

Kivy basic button program doesnt work #1199

matanix opened this issue Dec 18, 2017 · 1 comment

Comments

@matanix
Copy link

matanix commented Dec 18, 2017

Hey
I am trying to make my first app in kivy so i copied a basic button code.

class TestApp(App):
def build(self):
btn = Button(text="Press me")
return btn

if name == 'main':
TestApp().run()

however the button doesnt seem to be pressed when i click it with my mouse.

any suggestions how to fix this?

thanks

@germn
Copy link
Contributor

germn commented Dec 21, 2017

Your program works fine, you can bind some function to button state change as shown here to see it:

from kivy.app import App
from kivy.uix.button import Button


class TestApp(App):
    def build(self):
        btn = Button(text="Press me")
        
        def print_state(_, val):
            print(val)
        btn.bind(state=print_state)

        return btn


if __name__ == '__main__':
    TestApp().run()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants