Sunday, June 27, 2021

kivy2 box layout

from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.scatter import Scatter
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout

class buttonApp(App):
    def build(self):
        return Button(text = "Hello!",
                      background_color = (1, 0, 1, 1),
                      font_size=150)

class scatterApp(App):
    def build(self):
        f = FloatLayout()
        s = Scatter()
        l = Label(text="Hello!", font_size=150)

        f.add_widget(s)
        s.add_widget(l)
        return f

class boxApp(App):
    def build(self):
        b = BoxLayout()
        t = TextInput(font_size=150)

        f = FloatLayout()
        s = Scatter()
        l = Label(text="Hello!", font_size=150)

        f.add_widget(s)
        s.add_widget(l)

        b.add_widget(f)
        b.add_widget(t)
        return b

#buttonApp().run()
#scatterApp().run()
boxApp().run()

reference:

No comments:

Post a Comment