#:kivy 1.0 #:import kivy kivy : content: content canvas: Color: rgb: 1, 1, 1 Rectangle: source: 'data/images/background.jpg' size: self.size BoxLayout: orientation: 'vertical' BoxLayout: padding: 10 spacing: 10 size_hint: 1, None pos_hint: {'top': 1} height: 44 Image: size_hint: None, None size: 24, 24 source: 'data/logo/kivy-icon-24.png' Label: height: 24 text_size: self.width, None color: (1, 1, 1, .8) text: 'Kivy %s - Showcase' % kivy.__version__ FloatLayout: id: content : scale_min: 1 Image: source: 'data/logo/kivy-icon-512.png' : scale_min: 1 canvas: Color: rgba: .5, .5, .5, .2 Rectangle: size: self.size BoxLayout: size: root.size padding: 40 Button: text: 'Hello' Button: text: 'World' [Title@Label] pos_hint: {'center_x': .5, 'y': .3} text: ctx.text font_size: 22 Title: text: 'Anchor Layout' AnchorLayout: size_hint: .5, .5 pos_hint: {'center_x':.5, 'center_y':.5} anchor_x: root.anchor_x anchor_y: root.anchor_y # highlight the Layout area canvas: Color: rgba: .1, .3, .1, .51 Rectangle: size: self.size pos: self.pos Button: text: 'anchor_x = %s\nanchor_y = %s' %(root.anchor_x, root.anchor_y) size_hint: None, None size: 150, 50 blayout: blayout Title: text: "Box Layout" BoxLayout: id:blayout # highlight the Layout area size_hint: .5, .5 pos_hint: {'center_x':.5, 'center_y':.5} canvas: Color: rgba: .1, .3, .1, .51 Rectangle: size: self.size pos: self.pos flayout: flayout Title: text: "Float Layout" FloatLayout: id: flayout # highlight the Layout area size_hint: .5, .5 pos_hint: {'center_x':.5, 'center_y':.5} canvas: Color: rgba: .1, .3, .1, .51 Rectangle: size: self.size pos: self.pos glayout: glayout Title: text: "Grid Layout" GridLayout: id: glayout # highlight the Layout area size_hint: .5, .5 pos_hint: {'center_x':.5, 'center_y':.5} canvas: Color: rgba: .1, .3, .1, .51 Rectangle: size: self.size pos: self.pos slayout: slayout Title: text: "Stack Layout" StackLayout: id: slayout # highlight the Layout area size_hint: .5, .5 pos_hint: {'center_x':.5, 'center_y':.5} canvas: Color: rgba: .1, .3, .1, .51 Rectangle: size: self.size pos: self.pos [VSeparator@Widget]: size_hint_x: None width: 10 canvas: Color: rgba: .8, .8, .8, .3 Rectangle: size: 1, self.height pos: self.center_x, self.y [HSeparator@Label]: size_hint_y: None height: 45 text: ctx.text if 'text' in ctx else '' text_size: self.size valign: 'middle' halign: 'center' canvas.before: Color: rgba: .2, .2, .2, .8 Rectangle: size: self.size pos: self.pos : BoxLayout: pos_hint: {'x': 0, 'y': 0} BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 HSeparator: text: 'Buttons' Button: text: 'Button ' + self.state Button: text: 'Button ' + self.state state: 'down' ToggleButton: text: 'Toggle ' + self.state HSeparator: text: 'Toggle buttons with group' ToggleButton: text: 'Toggle 1' group: 'tgroup' ToggleButton: text: 'Toggle 2' group: 'tgroup' BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 HSeparator: text: 'Sliders' Slider: value: 25 size_hint_y: None height: 50 Slider: value: 75 size_hint_y: None height: 50 step: 25 BoxLayout: Slider: orientation: 'vertical' value: 25 Slider: orientation: 'vertical' value: 75 step: 25 HSeparator: text: 'Progress Bar' ProgressBar: value: (20 * root.value) % (1 + self.max) size_hint_y: None height: 50 HSeparator: text: 'Switch' Switch: size_hint_y: None height: 50 BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 HSeparator: text: 'Text inputs' TextInput: text: 'Monoline textinput' size_hint_y: None height: 30 TextInput: text: 'This is a password' size_hint_y: None height: 30 password: True TextInput: text: 'Readonly textinput' size_hint_y: None height: 30 readonly: True TextInput: text: 'Multiline textinput\nSecond line' HSeparator: text: 'Checkbox' GridLayout: rows: 1 CheckBox CheckBox GridLayout: cols: 2 CheckBox: group: 'group1' CheckBox: group: 'group1' CheckBox: group: 'group2' CheckBox: group: 'group2' : BoxLayout: pos_hint: {'x': 0, 'y': 0} BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 HSeparator: text: 'Accordions' Accordion: AccordionItem: title: 'Panel 1' Label: text: 'This is a label fit to the content view' AccordionItem: title: 'Panel 2' Button: text: 'A button, what else?' AccordionItem: title: 'Panel 3' Label: text: 'This is a label fit to the content view' Accordion: orientation: 'vertical' AccordionItem: title: 'Panel 1' Label: text: 'This is a label fit to the content view' AccordionItem: title: 'Panel 2' Button: text: 'A button, what else?' AccordionItem: title: 'Panel 3' Label: text: 'This is a label fit to the content view' VSeparator BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 HSeparator: text: 'File choosers' FileChooserListView FileChooserIconView : treeview1: treeview1 treeview2: treeview2 BoxLayout: pos_hint: {'x': 0, 'y': 0} BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 HSeparator: text: 'Treeview with root' TreeView: id: treeview1 Button: text: 'Remove first node' size_hint_y: None height: 50 on_release: treeview1.remove_node(treeview1.root.nodes[0]) if not treeview1.root.is_leaf else None BoxLayout: orientation: 'vertical' padding: 10 spacing: 10 HSeparator: text: 'Treeview without root' TreeView: id: treeview2 hide_root: True Button: text: 'Remove first node' size_hint_y: None height: 50 on_release: treeview2.remove_node(treeview2.root.nodes[0]) if not treeview2.root.is_leaf else None :