tabs.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:stig 作者: rndusr 项目源码 文件源码
def __init__(self, *contents, tabbar=None):
        """Create new Tabs widget

        contents: Iterable of dictionaries or iterables that match the arguments
                  of the `insert` method
        tabbar: TabBar instance that is used to display tab titles or any object
                with a 'base_widget' attribute (e.g. AttrMap) that returns a
                TabBar object
        """
        if tabbar is None:
            self._tabbar = TabBar()
        elif not isinstance(tabbar, urwid.Widget):
            raise ValueError('tabbar must be TabBar instance, not {}: {!r}'
                             .format(type(tabbar).__name__, tabbar))
        else:
            self._tabbar = tabbar

        self._ids = []
        self._contents = urwid.MonitoredFocusList()
        for content in contents:
            if not isinstance(content, collections.Mapping):
                content = dict(zip(('title', 'widget', 'position', 'focus'),
                                   content))
            self.insert(**content)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号