diff --git a/examples/demo/showcase/main.py b/examples/demo/showcase/main.py index fb35f3346..e0f79f0f0 100644 --- a/examples/demo/showcase/main.py +++ b/examples/demo/showcase/main.py @@ -13,6 +13,8 @@ from kivy.uix.scatter import Scatter from kivy.uix.textinput import TextInput from kivy.uix.treeview import TreeView, TreeViewLabel from kivy.uix.switch import Switch +from kivy.uix.label import Label +from kivy.uix.popup import Popup class Showcase(FloatLayout): @@ -69,8 +71,9 @@ class ShowcaseApp(App): n = create_tree('TreeView') attach_node('Standard treeview', n) attach_node('Treeview without root', n) - n = create_tree('Switch') - attach_node('Active switch', n) + n = create_tree('Others') + attach_node('Popup', n) + attach_node('Switch', n) root.add_widget(tree) self.content = content = BoxLayout() root.add_widget(content) @@ -127,11 +130,28 @@ class ShowcaseApp(App): multiline=False)) return col - def show_active_switch(self): + def show_switch(self): col = AnchorLayout() col.add_widget(Switch(active=True)) return col + def show_popup(self): + btnclose = Button(text='Close this popup', size_hint_y=None, height=50) + content = BoxLayout(orientation='vertical') + content.add_widget(Label(text='Hello world')) + content.add_widget(btnclose) + popup = Popup(content=content, title='Modal popup example', + size_hint=(None, None), size=(300, 300), + auto_dismiss=False) + btnclose.bind(on_release=popup.dismiss) + button = Button(text='Open popup', size_hint=(None, None), + size=(150, 70)) + button.bind(on_release=popup.open) + popup.open() + col = AnchorLayout() + col.add_widget(button) + return col + def show_standard_treeview(self): return self.populate_treeview(TreeView()) diff --git a/kivy/uix/popup.py b/kivy/uix/popup.py index f50b5e68d..1fd53dbd5 100644 --- a/kivy/uix/popup.py +++ b/kivy/uix/popup.py @@ -187,7 +187,6 @@ class Popup(FloatLayout): return True def on__anim_alpha(self, instance, value): - print value if value == 0 and self._window is not None: self._window.remove_widget(self) self._window = None