N_dim_cubes_color.py 文件源码

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

项目:N_Dimensional_Cubes_python 作者: Daniel-The-Coder 项目源码 文件源码
def Draw(lst, n):
    global color
    global draw
    global dim
    # print(lst)
    # print(lst[0][0])
    # print(str(lst[0][0]).isdigit())
    if (str(lst[0][0])).isdigit() or (str((-1) * lst[0][0]).isdigit()):
        # line(lst[0][0],lst[0][1],lst[1][0],lst[1][1])
        draw.line(((lst[0][0] + dim[0] + 150, lst[0][1] + dim[2] + 150),
                   (lst[1][0] + dim[0] + 150, lst[1][1] + dim[2] + 150)), fill=color, width=1)
    else:
        print(n)
        Draw(lst[0], n - 1)
        Draw(lst[1], n - 1)
        # t.pencolor(colors[n%6])
        color = colors[n % 6]
        lst1, lst2 = list(flatten(lst[0])), list(flatten(lst[1]))
        for i in range(0, len(lst1), 2):
            # line(lst1[i],lst1[i+1],lst2[i],lst2[i+1])
            draw.line(((lst1[i] + dim[0] + 150, lst1[i + 1] + dim[2] + 150),
                       (lst2[i] + dim[0] + 150, lst2[i + 1] + dim[2] + 150)), fill=color, width=1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号