本文整理汇总了Python中turtle.Turtle.hideturtle方法的典型用法代码示例。如果您正苦于以下问题:Python Turtle.hideturtle方法的具体用法?Python Turtle.hideturtle怎么用?Python Turtle.hideturtle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类turtle.Turtle
的用法示例。
在下文中一共展示了Turtle.hideturtle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def main():
t = Turtle()
# prompt the user for the number of steps
iterations = input("Enter the number of reps: ")
t.pencolor("red")
t.screen.bgcolor("blue")
t.width(10)
# run the walk with the parameters specified
# this walk starts at the origin (centre of the window) every time
randomWalkRandomColours(t, 0, 0, iterations)
t.hideturtle()
print '\n\nProgram Done!'
示例2: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [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()
示例3: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [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")
示例4: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [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)
示例5: Lampe
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
class Lampe():
lyser = False
turtle = None
def lag_skilpadde(self):
""" Lager en egen skilpadde for denne lamen."""
self.turtle = Turtle()
self.turtle.penup()
self.turtle.hideturtle()
# Gult lys når vi lyser.
self.turtle.shape('circle')
self.turtle.color('yellow')
self.turtle.shapesize(5)
def slaa_paa(self):
self.lyser = True
self.turtle.showturtle()
def slaa_av(self):
self.lyser = False
self.turtle.hideturtle()
示例6: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [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")
示例7: startTurtle
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def startTurtle():
t = Turtle()
t.hideturtle()
t.speed(10)
t.up()
t.setpos(-dim/2,-dim/2)
colormode(255)
return t
示例8: maketree
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def maketree(x, y):
p = Turtle()
p.color("green")
p.pensize(5)
p.hideturtle()
#p.getscreen().tracer(30)
p.speed(10)
p.left(90)
p.penup()
p.goto(x, y)
p.pendown()
t = tree([p], 110, 65, 0.6375)
示例9: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def init_drawman():
global t,xc,yc
t = Turtle()
t.penup()
xc = 0
yc = 0
t.goto(xc,yc)
t.speed(100)
t.hideturtle()
drawman_color(default_color)
drawman_scale(default_scale)
drawman_width(default_width)
示例10: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def main():
t = Turtle()
# promp user for number of steps in the walk
iterations = int(input("Enter the number of reps: "))
t.pencolor("red")
t.screen.bgcolor("black")
# run the walk with the parameters specified
# this walk starts at the origin (centre of the window) every time
selfAvoidingWalk_randomDist(t, 0, 0, iterations)
t.hideturtle()
print '\n\nProgram Done!'
示例11: maketree
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def maketree():
p = Turtle()
p.setundobuffer(None)
p.hideturtle()
p.speed(0)
p.getscreen().tracer(30,0)
p.left(90)
p.penup()
p.forward(-210)
p.pendown()
t = tree([p], 200, 65, 0.6375)
for x in t:
pass
示例12: init_drawman
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def init_drawman(x0=0,y0=0,grid_drawing=False):
global t, x_current, y_current,__grid_drawing,_operation, __center_x,__center_y
t = Turtle()
t.hideturtle()
t.speed(0)
_operation=[]
_grid_drawing=grid_drawing
center_x=x0
center_y=y0
drawman_scale(default_scale_x,default_scale_y)
t.penup()
x_current = x0
y_current = y0
t.goto(x_current, y_current)
示例13: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def main():
t = Turtle()
# prompt for user inputs
iterations = int(input("Enter the number of reps: "))
length = int(input("Enter the distance travelled for each step: "))
t.pencolor("red")
t.screen.bgcolor("black")
# run the walk with the parameters specified
# this walk starts at the origin (centre of the window) every time
selfAvoidingWalk(t, 0, 0, iterations, length)
t.hideturtle()
print '\n\nProgram Done!'
示例14: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def main():
# Get the level from the command line argument
if len(sys.argv) == 1:
level = 1
else:
level = int(sys.argv[1])
t = Turtle()
t.speed(0)
t.hideturtle()
x = t.screen.window_width() // 2 - 20
y = t.screen.window_height() // 2 - 20
mondrian(t, -x, y, x, -y, level)
# Stop the fly-by window in the terminal
input("Press enter to quit: ")
示例15: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import hideturtle [as 别名]
def main():
swarmSize = 50
t = Turtle()
win = Screen()
win.setworldcoordinates(-600,-600,600,600)
t.speed(10)
t.hideturtle()
t.tracer(15)
for i in range(swarmSize):
FocalFish()
for turn in range(300):
for schooler in Schooler.swarm:
schooler.getNewHeading()
for schooler in Schooler.swarm:
schooler.setHeadingAndMove()
win.exitonclick()