Work with Widgets

Simple HTML tags and pages are Python Widgets. Higher level user interface elements, such as TabbedPanels and the Tabs on them, are also Widgets. Compose your user interface by adding Widgets as the children of other Widgets.

Everything happens in Python: HTML/css/javascript/etc implementation details are hidden and dealt with behind the scenes.

Try it out

  • Click on different tabs of the TabbedPanel below.

A paragraph to give content to the first tab.

And another ... to give content to the second tab.

Something else on the third tab.

class TabbedPanelExample(Widget):
    def __init__(self, view):
        super(TabbedPanelExample, self).__init__(view)

        tabbed_panel = self.add_child(TabbedPanel(view))

        contents1 = P.factory(text='A paragraph to give content to the first tab.')
        tabbed_panel.add_tab(Tab(view, 'Tab 1', '1', contents1))

        contents2 = P.factory(text='And another ...  to give content to the second tab.')
        tabbed_panel.add_tab(Tab(view, 'Tab 2', '2', contents2))

        contents3 = P.factory(text='Something else on the third tab.')
        tabbed_panel.add_tab(Tab(view, 'Tab 3', '3', contents3))