example of modal view

90 views
Skip to first unread message

Mohit Narwani

unread,
Oct 30, 2022, 5:39:54 AM10/30/22
to Kivy users support
Please share with me minimum example of modal view

Elliot Garbus

unread,
Oct 30, 2022, 8:57:37 AM10/30/22
to kivy-...@googlegroups.com

A modal view is the base class of a Popup.  It is the same as a Popup without the styling.  Here is an example:

 

from kivy.app import App
from kivy.lang import Builder

kv =
"""
#:import Factory kivy.factory.Factory

<ExampleModal@ModalView>:
    size_hint: .8, .8
    BoxLayout:
        padding: 20
        orientation: 'vertical'
        Label:
            text: 'Modal View'
        Button:
            size_hint_y: None
            height: 48
            text: 'Close'
            on_release: root.dismiss()
       
AnchorLayout:
    Button:
        size_hint: None, None
        size: 200, 48
        text: 'Open ModalView'
        on_release: Factory.ExampleModal().open()
"""


class ModalExampleApp(App):
   
def build(self):
       
return Builder.load_string(kv)


ModalExampleApp().run()

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/393f175f-bd24-4331-ab33-80c4daef00b2n%40googlegroups.com.

 

Reply all
Reply to author
Forward
0 new messages