Monday, June 21, 2021

kivy 1

float layout scatter

button with purple background
#tutorial1.py
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

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

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

reference:

No comments:

Post a Comment