You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromkivy.langimportBuilderfromkivy.factoryimportFactoryfromkivymd.appimportMDAppBuilder.load_string(
"""<ExampleBanner@Screen> MDBanner: id: banner over_widget: scroll MDToolbar: id: toolbar title: app.title md_bg_color: app.theme_cls.primary_color elevation: 10 left_action_items: [["dots-vertical", lambda x: None]] pos_hint: {"top": 1} ScrollView: id: scroll size_hint_y: None height: Window.height - toolbar.height MDGridLayout: id: box adaptive_height: True cols: 1 padding: "10dp" spacing: "10dp" OneLineListItem: text: "ThreeLineBanner" on_release: banner.type = "three-line" banner.text = \ [\ "Three line string text example with two actions.", \ "This is the second line of the banner message,", \ "and this is the third line of the banner message.", ] banner.left_action = ["CANCEL", lambda x: None] banner.right_action = ["CLOSE", lambda x: banner.hide()] banner.show() OneLineListItem: text: "TwoLineBanner" on_release: banner.type = "two-line" banner.text = \ [\ "One line string text example with two actions.", \ "This is the second line of the banner message.", \ ] banner.left_action = ["CANCEL", lambda x: None] banner.right_action = ["CLOSE", lambda x: banner.hide()] banner.show() OneLineListItem: text: "OneLineBanner" on_release: banner.type = "one-line" banner.text = ["One line string text example with two actions."] banner.left_action = ["CANCEL", lambda x: None] banner.right_action = ["CLOSE", lambda x: banner.hide()] banner.show() OneLineListItem: text: "ThreeLineIconBanner" on_release: banner.type = "three-line-icon" banner.text = \ [\ "Three line string text example with two actions.", \ "This is the second line of the banner message,", \ "and this is the third line of the banner message.", ] banner.left_action = ["CANCEL", lambda x: None] banner.right_action = ["CLOSE", lambda x: banner.hide()] banner.show() OneLineListItem: text: "TwoLineIconBanner" on_release: banner.type = "two-line-icon" banner.text = \ [\ "One line string text example with two actions.", \ "This is the second line of the banner message.", \ ] banner.left_action = ["CANCEL", lambda x: None] banner.right_action = ["CLOSE", lambda x: banner.hide()] banner.show() OneLineListItem: text: "OneLineIconBanner" on_release: banner.type = "one-line-icon" banner.text = ["One line string text example with two actions."] banner.left_action = ["CANCEL", lambda x: None] banner.right_action = ["CLOSE", lambda x: banner.hide()] banner.show() OneLineListItem: text: "Banner without actions" on_release: banner.type = "one-line-icon" banner.text = ["One line string text example without actions."] banner.left_action = [] banner.right_action = [] banner.show() OneLineListItem: text: "Banner with one actions" on_release: banner.type = "one-line-icon" banner.text = ["One line string text example without actions."] banner.left_action = [] banner.right_action = ["CLOSE", lambda x: banner.hide()] banner.show()"""
)
classMainApp(MDApp):
def__init__(self, **kwargs):
super().__init__(**kwargs)
self.title="KivyMD Examples - Banner"self.theme_cls.primary_palette="DeepPurple"defbuild(self):
self.root=Factory.ExampleBanner()
if__name__=="__main__":
MainApp().run()