Home > Back-end >  i expected this code to create a range of buttons on the displaying screen
i expected this code to create a range of buttons on the displaying screen

Time:07-04

from kivy.app import App

from kivy.uix.button import Button

from kivy.uix.stacklayout import StackLayout


class Stacklayout(StackLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        for i in range(0, 10):
            b = Button(text="bruh", size_hint=(1, 1))
            self.add_widget(b)


class TheLabApp(App):
    pass


TheLabApp().run()

CodePudding user response:

Your App does not have a build() method, so nothing is built and nothing is displayed.

Try modifying your App:

class TheLabApp(App):
    def build(self):
        return Stacklayout()
  • Related