def load_content(self): self.layout.clear_widgets() toolbar = MDToolbar(type="top") toolbar.left_action_items = [["arrow-left", self.go_back]] toolbar.right_action_items = [["plus", self.add_book]] title_label = MDLabel( text="Title: ", halign="left", valign="top", ) subtitle_label = MDLabel( text="Subtitle: ", halign="left", valign="top", ) price_label = MDLabel( text="Price: ", halign="left", valign="top", ) self.title_input = MDTextField() self.subtitle_input = MDTextField() self.price_input = MDTextField() self.layout.add_widget(toolbar) self.layout.add_widget(title_label) self.layout.add_widget(self.title_input) self.layout.add_widget(subtitle_label) self.layout.add_widget(self.subtitle_input) self.layout.add_widget(price_label) self.layout.add_widget(self.price_input)
def on_enter(self, *args): root = BoxLayout(orientation='vertical') toolbar = MDToolbar(title='Меню') toolbar.right_action_items = [[ "dots-vertical", lambda x: self.nav_drawer.set_state('toggle') ]] root.add_widget(toolbar) root.add_widget(Widget()) self.add_widget(root)
def __init__(self, **kwargs): super(RootWidget, self).__init__(**kwargs) self.anchor_x = 'right' self.anchor_y = 'top' mapview = MapView(zoom=11, lat=self.lat, lon=self.lon) self.add_widget(mapview) toolbar = MDToolbar( title="Map", background_palette="Primary", background_hue="500", elevation=10, ) toolbar.left_action_items = [["arrow-left", lambda x: x]] toolbar.right_action_items = [["magnify", lambda x: self.show_confirmation_dialog()]] self.add_widget(toolbar)
def load_screen(self, book): """Loads all elements for the detailed info. Created as separate method because on every book we need to reload the information. """ self.book = book toolbar = MDToolbar(type="top") toolbar.left_action_items = [["arrow-left", self.go_back]] toolbar.right_action_items = [["delete", self.delete_item]] content = BookInfoContent(book) self.layout.add_widget(toolbar) self.layout.add_widget(content)
def __init__(self): super(MyApp, self).__init__() self.boxlayout1 = MDBoxLayout(orientation="vertical") toolbar = MDToolbar(title="DEMO APP") toolbar.left_action_items = [["menu", "This is the navigation"]] toolbar.right_action_items = [[ "dots-vertical", lambda x: self.callback_1(x) ], ["clock"]] self.boxlayout1.add_widget(toolbar) self.boxlayout2 = MDBoxLayout() self.boxlayout1.add_widget(self.boxlayout2) from kivymd.uix.navigationrail import MDNavigationRail, MDNavigationRailItem self.navigationrail = MDNavigationRail( md_bg_color=get_color_from_hex("#ffffff"), # color_normal = get_color_from_hex("#718089"), #crash the app when clicking on an item, don't understand why... color_active=get_color_from_hex("#f3ab44"), visible="Persistent") self.item1 = MDNavigationRailItem(navigation_rail=self.navigationrail, text="Detection", icon='video-stabilization') self.item2 = MDNavigationRailItem(navigation_rail=self.navigationrail, text="Dashboard", icon='desktop-mac-dashboard') self.item3 = MDNavigationRailItem(navigation_rail=self.navigationrail, text="Settings", icon='cog-outline') self.navigationrail.add_widget(self.item1) self.navigationrail.add_widget(self.item2) self.navigationrail.add_widget(self.item3) self.boxlayout2.add_widget(self.navigationrail)