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

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

项目:L-Systems-Compiler-And-Renderer    作者:Mizzlr    | 项目源码 | 文件源码
def __init__(self, save_every_frame=False,
        speed=0):
        self.name = ''
        self.variables = []
        self.constants = []
        self.axiom = ''
        self.rules = []
        self.angle = 90
        self.length = 10
        self.generation = []
        self.save_every_frame = save_every_frame
        tt.speed(speed)
项目:jvcprojectortools    作者:arvehj    | 项目源码 | 文件源码
def plot_table(self, *gamma, colors=['red', 'green', 'blue'], draw_speed=16, scale_x=1):
        """Plot gamma table"""
        if len(gamma) == 1 and len(gamma[0]) == 3:
            gamma = gamma[0]
        if all(x == gamma[0] for x in gamma):
            gamma = gamma[:1]

        turtle.penup()
        turtle.tracer(0, 16)
        turtle.speed(0)
        turtle.color('black')
        for color, points_y in enumerate(gamma):
            if len(gamma) == len(colors):
                turtle.color(colors[color])
            elif len(colors) == 1:
                turtle.color(colors[0])
            for x, y in enumerate(points_y):
                trace = x and x % draw_speed == 0
                if trace:
                    turtle.tracer(1)
                turtle.setposition(x * scale_x, y)
                if trace:
                    turtle.tracer(0)
                if x == 0:
                    turtle.showturtle()
                    turtle.pendown()

            turtle.penup()
            turtle.hideturtle()
            turtle.update()
项目:Scheme    作者:StephenK1998    | 项目源码 | 文件源码
def tscheme_speed(s):
    """Set the turtle's animation speed as indicated by S (an integer in
    0-10, with 0 indicating no animation (lines draw instantly), and 1-10
    indicating faster and faster movement."""
    check_type(s, scheme_integerp, 0, "speed")
    _tscheme_prep()
    turtle.speed(s)
    return okay
项目:Charon    作者:forrestchang    | 项目源码 | 文件源码
def tscheme_speed(s):
    """Set the turtle's animation speed as indicated by S (an integer in
    0-10, with 0 indicating no animation (lines draw instantly), and 1-10
    indicating faster and faster movement."""
    check_type(s, scheme_integerp, 0, "speed")
    _tscheme_prep()
    turtle.speed(s)
    return okay
项目:monty    作者:shoeffner    | 项目源码 | 文件源码
def init():
    turtle.reset()
    turtle.shape('turtle')
    turtle.speed('fastest')
    turtle.up()
项目:SchemeInterpreter    作者:GrantHiggins16    | 项目源码 | 文件源码
def tscheme_speed(s):
    """Set the turtle's animation speed as indicated by S (an integer in
    0-10, with 0 indicating no animation (lines draw instantly), and 1-10
    indicating faster and faster movement."""
    check_type(s, scheme_integerp, 0, "speed")
    _tscheme_prep()
    turtle.speed(s)
    return okay
项目:particle_filter    作者:rcorona    | 项目源码 | 文件源码
def __init__(self):
        #Creates display for visualization. 
        self.window = turtle.Screen()
        turtle.setworldcoordinates(-5, -5, 5, 5)
        turtle.speed(0)

        #Initializes ROS and subscribes to particle filter. 
        rospy.init_node('particle_visualizer', anonymous=True)
        rospy.Subscriber('particle_filter', Particle_vector, self.update)

        #Initializes list of particles. 
        self.particles = []
项目:dwinelle-tools    作者:dkess    | 项目源码 | 文件源码
def draw_floor(floornum: int):
    global current_floor
    current_floor = floornum

    node_coords = utils.get_node_coords(utils.Direction.left) 

    if floornum == len(full_floors):
        rooms = []
        # All edges with rooms
        print('Showing everything')
        edges = chain.from_iterable(chain(((True, e) for e in edges[0]), ((False, e) for e in edges[1])) for _, edges in full_floors)
        # Edges with elevation changes
        #edges = set(chain.from_iterable((edge(v, n) for n in b.values() if set(['u', 'd']) & set(utils.get_graph().edgedata[edge(v, n)]['rooms'])) for v, b in enumerate(utils.get_graph().branches)))
        # All edges
        #...
    elif floornum >= 0 and floornum < len(full_floors):
        rooms, edges = full_floors[floornum]
        print(edges)
        edges = chain(((True, e) for e in edges[0]), ((False, e) for e in edges[1]))
        print(rooms)
    else:
        return

    turtle.showturtle()
    turtle.speed(0)
    turtle.clear()

    written_nodes = set()

    for edge_dir, (a, b) in edges:
        turtle.penup()
        x, y, _ = node_coords[a]
        turtle.goto(x / SHRINK + X_OFFSET, y / SHRINK + Y_OFFSET)
        if a not in written_nodes:
            turtle.write(a)
            written_nodes.add(a)

        turtle.pendown()

        if edge_dir:
            if edge_lengths[edge(a, b)] <= 0:
                turtle.pencolor('red')
            else:
                turtle.pencolor('black')
        else:
            if edge_lengths[edge(a, b)] <= 0:
                turtle.pencolor('blue')
            else:
                turtle.pencolor('green')

        x, y, _ = node_coords[b]
        turtle.goto(x / SHRINK + X_OFFSET, y / SHRINK + Y_OFFSET)
        turtle.pencolor('black')
        if b not in written_nodes:
            turtle.write(b)
            written_nodes.add(b)

    turtle.hideturtle()
    turtle.done()