Pagination
def create_pagination_widget(self, view): items = ['item number %s' % i for i in range(1,101)] class PageContainer(PagedPanel): def __init__(self, parent, page_index): super().__init__(parent, page_index, 'container') for item in self.current_contents: self.add_child(P(view, text=item)) class PaginationWidget(Div): def __init__(self, view): super().__init__(view) page_index = SequentialPageIndex(items, items_per_page=5, max_page_links=9) page_container = self.add_child(PageContainer(self.view, page_index)) self.add_child(PageMenu(self.view, 'page_menu_widget', page_index, page_container)) return PaginationWidget(view)
Tabbed Panel
tab 1/1 content
tab 1/2 content
tab 3 content
tab 4 content
def create_tabbed_panel(self, view): class PopulatedTabbedPanel(TabbedPanel): def __init__(self, view): super().__init__(view) multi_tab = MultiTab(view, 'multitab name', 'multi-main') tab1 = Tab(view, 'tab 1 name', 'multi1', P.factory(text='tab 1/1 content')) tab2 = Tab(view, 'tab 2 name', 'multi2', P.factory(text='tab 1/2 content')) multi_tab.add_tab(tab1) multi_tab.add_tab(tab2) self.add_tab(multi_tab) tab3 = Tab(view, 'tab 3 name', 'tab3', P.factory(text='tab 3 content')) self.add_tab(tab3) tab4 = Tab(view, 'tab 4 name', 'tab4', P.factory(text='tab 4 content')) self.add_tab(tab4) return PopulatedTabbedPanel(view)
Link with Popup
def create_link_with_popup(self, view): return PopupA(view, self.get_code_of_conduct_bookmark(), '#bd .container section')
Badge
The world is big ( 世界は大きい )
def create_badge(self, view): return Badge(view, 'The world is big ( 世界は大きい )', 'info', pill=True)
Plain alert
You have been alerted
def create_plain_alert(self, view): return Alert(view, 'You have been alerted', 'warning')
Carousel with banners
def create_carousel(self, view): carousel = Carousel(view, 'my_carousel_id', show_indicators=True) carousel.add_control(previous=True) carousel.add_control() carousel.add_slide(PlaceholderImage(view, 800, 300, text='Placeholder image', theme=PredefinedTheme('lava'))) carousel.add_slide(PlaceholderImage(view, 800, 300, text='Another placeholder', theme=CustomTheme(bg='00216f', fg='ffffff'))) carousel.add_slide(PlaceholderImage(view, 800, 300, text='Use an Img here', theme=PredefinedTheme('industrial'))) return carousel