In this video I’ll show you how to use the Splitters to split apart different sections or Widgets of your app and allow the user to resize things on the fly.
Splitters allow your user to resize or rearrange parts of your app themselves on the fly. They’re really easy to use, just call a Splitter Widget in your KV file on any widget you want to make resizable. Then set the direction that the splitter will go.
Python Code: split.py
GitHub Code: split.py
from kivy.app import App from kivy.uix.widget import Widget from kivy.properties import ObjectProperty from kivy.lang import Builder # Designate Our .kv design file Builder.load_file('split.kv') class MyLayout(Widget): pass class AwesomeApp(App): def build(self): return MyLayout() if __name__ == '__main__': AwesomeApp().run()
Kivy Design Code: split.kv
GitHub Code: split.kv
<MyLayout> BoxLayout: orientation: "vertical" size: root.width, root.height Splitter: sizable_from: 'bottom' Button: text: "Hello World 1" font_size: 32 Label: text: "This is some text!" font_size: 32 Splitter: sizable_from: 'top' Button: text: "Hello World 2" font_size: 32 GridLayout: cols:2 Button: text: "Left" font_size: 32 Splitter: sizable_from: 'left' Button: text: "Right" font_size: 32
Add comment