【Kivy】RelativeLayout を利用し、画面サイズに応じて配置する
- main.py
from kivy.app import App class MainApp(App): pass if __name__ == '__main__': MainApp().run()
- main.kv
#:kivy 1.0 RelativeLayout: Button: text: 'button 1' size_hint: None, None size: 400, 1200 pos_hint: {'x': .4, 'y': .1} Button: text: 'button 2' size_hint: None, None size: 200, 300 pos_hint: {'x': .1, 'y': .5} Button: text: 'button 3' size_hint: None, None size: 200, 200 pos_hint: {'x': .2, 'y': .3} Button: text: 'button 4' size_hint: None, None size: 400, 80 pos_hint: {'x': .5, 'y': .2}