Gestures.py 文件源码

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

项目:pythonista-gestures 作者: mikaelho 项目源码 文件源码
def create_label(title):
    global label_count
    label_count += 1
    label_w = 175
    label_h = 75
    gap = 10
    label_w_with_gap = label_w + gap
    label_h_with_gap = label_h + gap
    labels_per_line = math.floor((v.width-2*gap)/(label_w+gap))
    left_margin = (v.width - labels_per_line*label_w_with_gap + gap)/2
    line = math.floor(label_count/labels_per_line)
    column = label_count - line*labels_per_line

    l = ui.Label(
      text=title, 
      background_color='grey',
      text_color='white',
      alignment=ui.ALIGN_CENTER,
      number_of_lines=0,
      frame=(
        left_margin+column * label_w_with_gap,
        gap+line * label_h_with_gap,
        label_w, label_h
    ))
    v.add_subview(l)
    return l
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号