当前位置: 首页>>代码示例>>Python>>正文


Python Turtle.speed方法代码示例

本文整理汇总了Python中turtle.Turtle.speed方法的典型用法代码示例。如果您正苦于以下问题:Python Turtle.speed方法的具体用法?Python Turtle.speed怎么用?Python Turtle.speed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在turtle.Turtle的用法示例。


在下文中一共展示了Turtle.speed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main():
    """This is run only when F5 is pressed from IDLE or when
    this file is run as a script in a terminal window."""
    t = Turtle()
    t.hideturtle()
    t.speed(0)
    t.pencolor("blue")
开发者ID:staufferl16,项目名称:Programming111,代码行数:9,代码来源:turtleexamples2.py

示例2: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main():
	# creating a window
	window = Screen()
	# window.bgcolor("orange")

	remo = Turtle()
	remo.shape("turtle")
	remo.color("green")
	remo.speed(50)

	for i in range(36):
		remo.circle(100)
		remo.left(10)

	remo.color("red")

	for i in range(36):
		remo.circle(80)
		remo.left(10)

	remo.color("yellow")

	for i in range(36):
		remo.circle(60)
		remo.left(10)


	window.exitonclick()
开发者ID:kunalprompt,项目名称:computerScienceFundamentals,代码行数:30,代码来源:playing_with_turtle.py

示例3: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main():
    turtle = Turtle()
    turtle.speed(0)
    turtle.home()
    turtle.left(90)
    drawTree(turtle, 8, 150)
    done()
开发者ID:yj29,项目名称:PythonAssignments,代码行数:9,代码来源:class9thsept.py

示例4: startTurtle

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def startTurtle():
    t = Turtle()
    t.speed(10)
    t.up()
    t.setpos(-dim/2,-dim/2)
    colormode(255)
    return t
开发者ID:tmmgarcia,项目名称:uwa-2014-cits1401-2,代码行数:9,代码来源:drawBoard.py

示例5: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main():
    """Render a trio of trees"""

    my_turtle = Turtle()
    my_turtle.hideturtle()
    my_turtle.speed(0)
    my_turtle.home()

    ## a big tree
    my_tree = Tree()
    my_turtle.pencolor("brown")
    my_turtle.pensize(4)
    my_tree.draw(my_turtle, trunk=100, max_depth=5)
    # draw over in another color
    my_turtle.pencolor("green")
    my_turtle.pensize(1)
    my_tree.draw(my_turtle)

    ## a slightly smaller tree
    my_turtle.penup()
    my_turtle.goto(175, 30)
    my_tree = Tree()
    my_tree.draw(my_turtle, trunk=80, max_depth=4)

    ## a Charlie Brown tree
    my_turtle.penup()
    my_turtle.goto(-150, 40)
    my_tree = Tree()
    my_tree.draw(my_turtle, trunk=40, max_depth=2)

    my_turtle.penup()
    my_turtle.goto(0, -50)
    my_turtle.write("Click in window to close")
开发者ID:mpclemens,项目名称:python-explore,代码行数:35,代码来源:tree3.py

示例6: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main():
    p = Turtle()
    p.color("green")
    p.pensize(3)
    #p.setundobuffer(None)
    p.hideturtle() #Make the turtle invisible. It’s a good idea to do this while you’re in the middle of doing some complex drawing,
    #because hiding the turtle speeds up the drawing observably.
    #p.speed(10)
    # p.getscreen().tracer(1,0)#Return the TurtleScreen object the turtle is drawing on.
    p.speed(10)
    #TurtleScreen methods can then be called for that object.
    p.left(90)# Turn turtle left by angle units. direction 调整画笔
 
    p.penup() #Pull the pen up – no drawing when moving.
    p.goto(0, -80)#Move turtle to an absolute position. If the pen is down, draw line. Do not change the turtle’s orientation.
    p.pendown()# Pull the pen down – drawing when moving. 这三条语句是一个组合相当于先把笔收起来再移动到指定位置,再把笔放下开始画
    #否则turtle一移动就会自动的把线画出来
 
    #t = tree([p], 200, 65, 0.6375)
    t = tree([p], 200, 65, 0.6375)
    p.penup() #Pull the pen up – no drawing when moving.
    p.home()
    p.goto(0, 80)
    p.pendown()# P
    p.right(90);
    t1 = tree([p], 200, 65, 0.6375)
开发者ID:allensdz,项目名称:python,代码行数:28,代码来源:DrawTree.py

示例7: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main(configuration):
    t = Turtle()
    t.speed(10)
    t.up()
    t.setpos(-configuration['size']/2,-configuration['size']/2)
    colormode(255)
    sierpinski(t,configuration['level'],configuration['size'])
开发者ID:tmmgarcia,项目名称:uwa-2014-cits1401-sierpinski,代码行数:9,代码来源:runner.py

示例8: draw_figures

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def draw_figures(figures):
    for figure in figures:
        t = Turtle()
        t.speed('slow')
        figure.draw_figure(t)

    done()
开发者ID:wencakisa,项目名称:Python-Dev,代码行数:9,代码来源:draw.py

示例9: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main():
    swarmSize = 100
    t = Turtle()
    win = Screen()
    win.setworldcoordinates(-600, -600, 600, 600)
    t.speed(10)
    t.hideturtle()
    t.tracer(15)

    for i in range(swarmSize):
        if random.randrange(100) == 0:
            LeaderFish()
        else:
            FocalFish()

    for i in range(5):
        Obstacle()

    for turn in range(1000):
        for schooler in Schooler.swarm:
            schooler.getNewHeading()

        for schooler in Schooler.swarm:
            schooler.setHeadingAndMove()

    win.exitonclick()
开发者ID:Tyro17,项目名称:runestone,代码行数:28,代码来源:swarm.py

示例10: test_segments_stored

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
    def test_segments_stored(self):
        """With branching, some points exist"""
        my_turtle = Turtle()
        my_turtle.speed(0)
        my_tree = Tree()
        my_tree.draw(my_turtle, max_depth=1)

        self.assertTrue(len(my_tree.segments) > 0, "Some segments should be stored")
开发者ID:mpclemens,项目名称:python-explore,代码行数:10,代码来源:Tree.py

示例11: main

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def main():
    dimension = int(input('Enter dimension: '))

    t = Turtle()
    t.speed('fastest')
    t.pensize(3)

    draw_table(dimension, 50, t, -200, 300)
开发者ID:wencakisa,项目名称:Softuni-Python3,代码行数:10,代码来源:chess.py

示例12: add_turtle

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def add_turtle(name):
    t = Turtle()
    t.speed('fast')
    #t.penup()
    t.shape(turtle_shapes[len(turtles) % len(turtle_shapes)])
    turtles[name] = t
    t.setheading(90)  # Point up
    return t
开发者ID:dcbriccetti,项目名称:python-lessons,代码行数:10,代码来源:server.py

示例13: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def init_drawman():
    global t, x_current, y_current, _drawman_scale
    t = Turtle()
    t.penup()
    x_current = 0
    y_current = 0
    t.goto(x_current, y_current)
    drawman_scale(default_scale)
    t.speed(30)
开发者ID:Tatiana-2016,项目名称:kpk2016,代码行数:11,代码来源:drawman.py

示例14: test_points_stored

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
    def test_points_stored(self):
        """After one iteration, as least a trunk segment should be stored"""
        my_turtle = Turtle()
        my_turtle.speed(0)
        my_tree = Tree()
        my_tree.draw(my_turtle, max_depth=1)
        # whitebox

        self.assertTrue(len(my_tree._points) > 0, "Some points should be stored")
开发者ID:mpclemens,项目名称:python-explore,代码行数:11,代码来源:Tree.py

示例15: init_drawman

# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import speed [as 别名]
def init_drawman():
    global t, x_current, y_current, _drawman_scale
    t=Turtle()
    t.speed(100)
    t.penup()
    x_current = 0
    y_current = 0
    t.goto(x_current, y_current)
    _drawman_scale = 10
开发者ID:MolchanovaIA,项目名称:kpk,代码行数:11,代码来源:drawman.py


注:本文中的turtle.Turtle.speed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。