From 19d7ad7521ddb93421220c0000ab6222fefe310c Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Fri, 22 Apr 2011 00:52:55 +0200 Subject: [PATCH] showcase: add scatter examples --- examples/demo/showcase/main.py | 24 ++++++++++++++++++++++++ examples/demo/showcase/showcase.kv | 17 +++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/examples/demo/showcase/main.py b/examples/demo/showcase/main.py index 6d5bd415c..7c230604d 100644 --- a/examples/demo/showcase/main.py +++ b/examples/demo/showcase/main.py @@ -8,12 +8,20 @@ from kivy.uix.anchorlayout import AnchorLayout from kivy.uix.button import Button from kivy.uix.togglebutton import ToggleButton from kivy.uix.slider import Slider +from kivy.uix.widget import Widget +from kivy.uix.scatter import Scatter from kivy.uix.textinput import TextInput from kivy.uix.treeview import TreeView, TreeViewLabel class Showcase(FloatLayout): pass +class KivyImageScatter(Scatter): + pass + +class ButtonsScatter(Scatter): + pass + class ShowcaseApp(App): def on_select_node(self, instance, value): @@ -44,6 +52,9 @@ class ShowcaseApp(App): n = create_tree('Sliders') attach_node('Horizontal sliders', n) attach_node('Vertical sliders', n) + n = create_tree('Scatter') + attach_node('Scatter with image', n) + attach_node('Scatter with buttons', n) n = create_tree('Textinput') attach_node('Monoline textinput', n) attach_node('Multiline textinput', n) @@ -57,6 +68,19 @@ class ShowcaseApp(App): sc.content.add_widget(root) return sc + def show_scatter_with_image(self): + s = KivyImageScatter(center=self.content.center) + col = Widget() + col.add_widget(s) + return col + + def show_scatter_with_buttons(self): + s = ButtonsScatter(size=(300, 200)) + s.center = self.content.center + col = Widget() + col.add_widget(s) + return col + def show_standard_buttons(self): col = BoxLayout(spacing=10) col.add_widget(Button(text='Hello world')) diff --git a/examples/demo/showcase/showcase.kv b/examples/demo/showcase/showcase.kv index da06bf27f..71cd18410 100644 --- a/examples/demo/showcase/showcase.kv +++ b/examples/demo/showcase/showcase.kv @@ -32,3 +32,20 @@ FloatLayout: id: content +: + Image: + source: 'data/logo/kivy-icon-512.png' + +: + canvas: + Color: + rgba: .5, .5, .5, .5 + Rectangle: + size: self.size + BoxLayout: + size: root.size + padding: 40 + Button: + text: 'Hello' + Button: + text: 'World'