tui.py 文件源码

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

项目:mccurse 作者: khardix 项目源码 文件源码
def __init__(self, mod: Mod, *callbacks: Iterable[ModItemCallback]):
            """Wrap mod in the set of display widgets.

            Keyword arguments:
                mod: The :class:`Mod` to be wrapped.
                callbacks: The functions to be called when this object
                    is selected.
            """

            btn_prefix = '  ? '

            # Construct button (the selectable part)
            btn = urwid.Button('')
            btn._w = urwid.AttrMap(
                urwid.SelectableIcon([btn_prefix, mod.name], 2),
                'title', 'title_focus',
            )
            for callback in callbacks:
                urwid.connect_signal(btn, 'click', callback, user_args=[mod])

            # Construct the mod summary
            text = urwid.Padding(
                urwid.AttrMap(urwid.Text(mod.summary), 'description'),
                left=len(btn_prefix)*2,
            )

            pile = btn, text
            super().__init__(pile)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号