本文整理汇总了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")
示例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()
示例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()
示例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
示例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")
示例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)
示例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'])
示例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()
示例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()
示例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")
示例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)
示例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
示例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)
示例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")
示例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