caves.py 文件源码

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

项目:caves 作者: mikaelho 项目源码 文件源码
def __init__(self, spec):
    super().__init__()
    self.present('full_screen', hide_title_bar=True)

    spec.append(('Cancel', None))
    menu_content_height = len(spec) * (self.button_height + self.button_gap)
    self.menu_height = min(menu_content_height, self.menu_max_height)

    self.btns = []

    for (i, (action_title, action_func)) in enumerate(spec):
      action_wrapper = functools.partial(self.func_wrapper, action_func)

      bg_color = '#e9e1e1' if action_func else '#4e4b4b'
      tnt_color = 'black' if action_func else 'white'
      btn = ui.Button(
        title=action_title,
        action=action_wrapper,
        tint_color=tnt_color,
        background_color=bg_color,
        corner_radius=5
      )
      self.add_subview(btn)
      self.btns.append(btn)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号