Wednesday, June 30, 2021

kivy4 kivy language 1


#project structure
main.py
turorial.kv

#main.py
from kivy.uix.boxlayout import BoxLayout

class ScatterTextWidget(BoxLayout):
    pass

class TutorialApp(App):
    def build(self):
        return ScatterTextWidget()

TutorialApp().run()

-----------------
#tutorial.kv
<ScatterTextWidget>:
    orientation: 'vertical'
    TextInput:
        id: textinput_id
        font_size: 150
        size_hint_y: None
        height: 200
        text: 'default'
    FloatLayout:
        Scatter:
            Label:
                text: textinput_id.text
                font_size: 150

reference:

No comments:

Post a Comment