Why doesn't the button show up in the window

Viewed 31

I don't know why when I run, the window won't show the buttons that I've added Here is my code

from kivy.app import App
from kivy.metrics import dp
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.stacklayout import StackLayout
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from kivy.uix.widget import Widget


class StackLayoutExample(StackLayout):
    def __int__(self, **kwargs):
        super().__init__(**kwargs)
        b = Button(text="A", size_hint=(0.2, 0.2))
        self.add_widget(b)


class TheLabApp(App):
    pass


TheLabApp().run()

and the .kv file is simply this:

StackLayoutExample:
1 Answers

You wrote the typo def __int__ but you need def __init__.

Related