Python turtle 模块,right() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用turtle.right()

项目:monty    作者:shoeffner    | 项目源码 | 文件源码
def draw_world(curvature_step=0):
    if curvature_step > 0:
        villages = 360 // 4 // curvature_step
    else:
        villages = 5

    for i in range(villages):
        prepare_drawing()
        draw_house()
        finish_drawing()

        turtle.right(curvature_step)
        turtle.forward(LENGTH * 11)

        for j in range(3):
            prepare_drawing()
            draw_tree(3 + j % 2 * 2)
            finish_drawing()

            turtle.right(curvature_step)
            turtle.forward(LENGTH * 3)

        turtle.forward(LENGTH)
项目:L-Systems-Compiler-And-Renderer    作者:Mizzlr    | 项目源码 | 文件源码
def draw(self):
        "draws the lsystem on the screen"
        stack = []
        tt.penup()
        tt.setpos(0, -200)
        tt.seth(90)
        tt.pendown()

        print "Drawing the lsystem ..."
        for i, codebit in enumerate(self.generation[-1]):

            if codebit in ['F', 'A', 'B']:
                tt.forward(self.length)
                print '[ FRWD ] ', codebit
            elif codebit == '+':
                tt.right(self.angle)
                print '[ RGHT ] ', codebit
            elif codebit == '-':
                tt.left(self.angle)
                print '[ LEFT ] ', codebit
            elif codebit == '[':
                stack.append((tt.pos(), tt.heading()))
                print '[ PUSH ] ', (tt.pos(), tt.heading())
            elif codebit == ']':
                position,heading = stack.pop()
                print '[ POP  ] ', (position, heading)
                tt.penup()
                tt.goto(position)
                tt.seth(heading)
                tt.pendown()
            else:
                print '[ NOP  ] ', codebit

            if self.save_every_frame:
                self.save(frame=i)

        print "Done drawing"
        print "Saving file as %s.jpg" % self.name,
        self.save()
        print "Done"
项目:MyKnowledge    作者:guofei9987    | 项目源码 | 文件源码
def SetupClock(radius):
    # ??????
    turtle.reset()
    turtle.pensize(7)
    for i in range(60):
        Skip(radius)
        if i % 5 == 0:
            turtle.forward(20)
            Skip(-radius - 20)
        else:
            turtle.dot(5)
            Skip(-radius)
        turtle.right(6)
项目:nautical-combat    作者:horstjens    | 项目源码 | 文件源码
def zweig(laenge = 10, winkel=30, divisor=2):
    if laenge < 2:
        return
    turtle.forward(laenge)
    turtle.left(winkel)
    zweig(laenge//divisor, winkel, divisor)
    turtle.right(winkel*2)
    zweig(laenge//divisor, winkel, divisor)
    turtle.left(winkel)
    turtle.penup()
    turtle.forward(-laenge)
    turtle.pendown()
项目:Leetcode    作者:staticor    | 项目源码 | 文件源码
def moveTurtles(turtleList,dist,angle):
    for turtle in turtleList:   # Make every turtle on the list do the same actions.
        turtle.forward(dist)
        turtle.right(angle)
项目:IPC_2017-1    作者:jucimarjr    | 项目源码 | 文件源码
def draw_star(x, y, side):
    star_angle = 360.0/6
    left_angle = star_angle * 2
    tu.penup()
    tu.goto(x, y)
    tu.pendown()
    for i in range(6):
        tu.forward(side)
        tu.right(star_angle)
        tu.forward(side)
        tu.left(left_angle)
项目:Scheme    作者:StephenK1998    | 项目源码 | 文件源码
def tscheme_right(n):
    """Rotate the turtle's heading N degrees clockwise."""
    _check_nums(n)
    _tscheme_prep()
    turtle.right(n)
    return okay
项目:Scheme    作者:StephenK1998    | 项目源码 | 文件源码
def tscheme_circle(r, extent=None):
    """Draw a circle with center R units to the left of the turtle (i.e.,
    right if N is negative.  If EXTENT is not None, then draw EXTENT degrees
    of the circle only.  Draws in the clockwise direction if R is negative,
    and otherwise counterclockwise, leaving the turtle facing along the
    arc at its end."""
    if extent is None:
        _check_nums(r)
    else:
        _check_nums(r, extent)
    _tscheme_prep()
    turtle.circle(r, extent and extent)
    return okay
项目:Charon    作者:forrestchang    | 项目源码 | 文件源码
def tscheme_right(n):
    """Rotate the turtle's heading N degrees clockwise."""
    _check_nums(n)
    _tscheme_prep()
    turtle.right(n)
    return okay
项目:Charon    作者:forrestchang    | 项目源码 | 文件源码
def tscheme_circle(r, extent = None):
    """Draw a circle with center R units to the left of the turtle (i.e.,
    right if N is negative.  If EXTENT is not None, then draw EXTENT degrees
    of the circle only.  Draws in the clockwise direction if R is negative,
    and otherwise counterclockwise, leaving the turtle facing along the
    arc at its end."""
    if extent is None:
        _check_nums(r)
    else:
        _check_nums(r, extent)
    _tscheme_prep()
    turtle.circle(r, extent and extent)
    return okay
项目:monty    作者:shoeffner    | 项目源码 | 文件源码
def draw_tree(h):
    if h == 0:
        return
    turtle.forward(LENGTH * h)
    turtle.left(ANGLE)
    draw_tree(h - 1)
    turtle.right(2 * ANGLE)
    draw_tree(h - 1)
    turtle.left(ANGLE)
    turtle.backward(LENGTH * h)
项目:monty    作者:shoeffner    | 项目源码 | 文件源码
def draw_house():
    height = 5
    width = 7
    roofside = (width ** 2 / 2) ** (1 / 2)
    turtle.forward(LENGTH * height)  # left wall
    turtle.right(45)  # roof
    turtle.forward(LENGTH * roofside)
    turtle.right(90)
    turtle.forward(LENGTH * roofside)
    turtle.right(45)
    turtle.forward(LENGTH * height)  # right wall
    turtle.right(90)
    turtle.forward(LENGTH * width)  # bottom line
    turtle.right(90)
项目:monty    作者:shoeffner    | 项目源码 | 文件源码
def finish_drawing():
    turtle.right(90)
    turtle.up()
项目:SchemeInterpreter    作者:GrantHiggins16    | 项目源码 | 文件源码
def tscheme_right(n):
    """Rotate the turtle's heading N degrees clockwise."""
    _check_nums(n)
    _tscheme_prep()
    turtle.right(n)
    return okay
项目:SchemeInterpreter    作者:GrantHiggins16    | 项目源码 | 文件源码
def tscheme_circle(r, extent = None):
    """Draw a circle with center R units to the left of the turtle (i.e.,
    right if N is negative.  If EXTENT is not None, then draw EXTENT degrees
    of the circle only.  Draws in the clockwise direction if R is negative,
    and otherwise counterclockwise, leaving the turtle facing along the
    arc at its end."""
    if extent is None:
        _check_nums(r)
    else:
        _check_nums(r, extent)
    _tscheme_prep()
    turtle.circle(r, extent and extent)
    return okay
项目:python-practice    作者:VamsiSangam    | 项目源码 | 文件源码
def printPolygon(sides, sideLength):
    for steps in range(sides):
        turtle.forward(sideLength)
        turtle.right(360 / sides)
    return