python类begin_fill()的实例源码

scheme_primitives.py 文件源码 项目:Charon 作者: forrestchang 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def tscheme_end_fill():
    """Fill in shape drawn since last begin_fill."""
    _tscheme_prep()
    turtle.end_fill()
    return okay
turtle_dsl.py 文件源码 项目:lark 作者: erezsh 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run_instruction(t):
    if t.data == 'change_color':
        turtle.color(*t.children)   # We just pass the color names as-is

    elif t.data == 'movement':
        name, number = t.children
        { 'f': turtle.fd,
          'b': turtle.bk,
          'l': turtle.lt,
          'r': turtle.rt, }[name](int(number))

    elif t.data == 'repeat':
        count, block = t.children
        for i in range(int(count)):
            run_instruction(block)

    elif t.data == 'fill':
        turtle.begin_fill()
        run_instruction(t.children[0])
        turtle.end_fill()

    elif t.data == 'code_block':
        for cmd in t.children:
            run_instruction(cmd)
    else:
        raise SyntaxError('Unknown instruction: %s' % t.data)
scheme_primitives.py 文件源码 项目:SchemeInterpreter 作者: GrantHiggins16 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def tscheme_begin_fill():
    """Start a sequence of moves that outline a shape to be filled."""
    _tscheme_prep()
    turtle.begin_fill()
    return okay
scheme_primitives.py 文件源码 项目:SchemeInterpreter 作者: GrantHiggins16 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def tscheme_end_fill():
    """Fill in shape drawn since last begin_fill."""
    _tscheme_prep()
    turtle.end_fill()
    return okay


问题


面经


文章

微信
公众号

扫码关注公众号