2.1 设置大小

main.py

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout

class SizeFloat(FloatLayout):
    def __init__(self,**kwargs):
        super().__init__(**kwargs)
class SizeApp(App):
    def build(self):
        return SizeFloat()


if __name__ == '__main__':
    SizeApp().run()

size.kv

:
    Button:
        text:'Hello'
        size_hint:.2,.15
        pos_hint:{'x':0.2,'y':.6}
    Button:
        text:'Size'
        size_hint:.2,.15
        pos_hint:{'right':0.8,'top':.4}

2.1 设置大小_第1张图片

你可能感兴趣的:(python,kivy,python)