本文整理汇总了Python中turtle.home函数的典型用法代码示例。如果您正苦于以下问题:Python home函数的具体用法?Python home怎么用?Python home使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了home函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: grid
def grid():
"""this function draws the grid lines for the tic-tac-toe board"""
up()
right(90)
forward(65) # moves the turtle down to start the grid
left(90)
forward(30) # moves the turtle over to position for the vertical lines
down()
left(90)
forward(180) # draws the first grid
up()
left(90)
forward(60) # moves for the second vertical line
down()
left(90)
forward(180) # draws the second line
left(90)
up()
forward(120) # moves over the the bottom right of the imaginary square around
# the tic-tac-toe board
left(90)
forward(60) # moves the turtle to the position for the horizontal lines
left(90)
down()
forward(180) # draws the first horizontal
up()
right(90)
forward(60) # moves up for the second horizontal
down()
right(90)
forward(180) # draws the second horizontal
up()
turtle.home()
示例2: hands
def hands( freq=166 ):
"""Draw three hands.
:param freq: Frequency of refresh in milliseconds.
"""
global running
now= datetime.datetime.now()
time= now.time()
h, m, s, ms = time.hour, time.minute, time.second, int(time.microsecond/1000)
# Erase old hands.
while turtle.undobufferentries():
turtle.undo()
# Draw new hands.
hand( h*5+m/60+s/3600, .6*R, 3 )
hand( m+s/60, .8*R, 2 )
hand( s+ms/1000, .9*R, 1 )
# Draw date and time
turtle.penup(); turtle.home()
turtle.goto( 0, -120 ); turtle.write( now.strftime("%b %d %H:%M:%S"), align="center", font=("Helvetica", 24, "normal") )
# Reschedule hands function
if running:
# Reset timer for next second (including microsecond tweak)
turtle.ontimer( hands, freq-(ms%freq) )
示例3: passeio
def passeio(dim, lado, passos):
# Prepara grelha
turtle.speed(0)
grelha_2(dim,lado)
turtle.color('red')
turtle.home()
turtle.pendown()
# Passeio
turtle.speed(6)
turtle.dot()
turtle.showturtle()
lim_x = lim_y = (dim*lado)//2
cor_x = 0
cor_y = 0
for i in range(passos):
vai_para = random.choice(['N','E','S','W'])
if (vai_para == 'N') and (cor_y < lim_y):
cor_y += lado
turtle.setheading(90)
turtle.fd(lado)
elif (vai_para == 'E') and (cor_x < lim_x):
cor_x += lado
turtle.setheading(0)
turtle.fd(lado)
elif (vai_para == 'S') and (cor_y > -lim_y):
cor_y -= lado
turtle.setheading(270)
turtle.fd(lado)
elif (vai_para == 'W') and (cor_x > -lim_x):
cor_x -= lado
turtle.setheading(180)
turtle.fd(lado)
else:
print((vai_para,turtle.xcor(),turtle.ycor()))
continue
示例4: at
def at(x, y):
turtle.penup()
turtle.home()
turtle.forward(x)
turtle.left(90)
turtle.forward(y)
turtle.pendown()
示例5: theStem
def theStem(stemLength=100):
turtle.home()
turtle.forward(25)
turtle.left(90)
turtle.pensize(4)
turtle.color("green")
turtle.forward(stemLength)
示例6: message
def message(m1, m2): # 메시지를 화면에 표시하는 함수
t.clear()
t.goto(0, 100)
t.write(m1, False, "center", ("", 20))
t.goto(0, -100)
t.write(m2, False, "center", ("", 15))
t.home()
示例7: plano2d
def plano2d():
turtle.penup()
for i in range(13):
y = 264 - (44 *i)
turtle.penup()
turtle.setposition(-264,y)
turtle.pendown()
turtle.forward(528)
turtle.right(90)
for i in range(13):
x = -264 + (44*i)
turtle.penup()
turtle.setposition(x,264)
turtle.pendown()
turtle.forward(528)
turtle.penup()
turtle.home()
turtle.pendown()
turtle.color("blue")
turtle.pensize(3)
for i in range(4):
grados = 90 * (i+1)
turtle.home()
turtle.left(grados)
turtle.forward(264)
示例8: body
def body():
turtle.penup()
turtle.home()
turtle.left(90)
turtle.forward(50)
turtle.pendown()
turtle.forward(90)
示例9: Plus
def Plus():
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(-90)
turtle.forward(100)
turtle.right(-90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(-90)
turtle.forward(100)
turtle.right(-90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(-90)
turtle.forward(100)
turtle.right(-90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(-90)
turtle.forward(100)
turtle.home()
示例10: drawAnswer
def drawAnswer(x, path) :
initialize()
drawB(x[0],x[1])
for pos in path :
drawP(pos)
t.penup()
t.home()
sleep(2)
示例11: drawBoard
def drawBoard(): # Turtle function to draw the entire board
t.penup()
t.forward(-300)
t.pendown()
for i in range(4): ##This is when a catastrophe happens, biome gets deleted
biomeDraw("blue")
biomeDraw("red")
t.home()
示例12: makepop
def makepop(fn, *args):
turtle.home()
turtle.begin_poly()
fn(*args)
turtle.end_poly()
name = 'pop%d' % len(POPS)
turtle.register_shape(name, turtle.get_poly())
POPS.append(name)
示例13: rightleg
def rightleg():
turtle.penup()
turtle.home()
turtle.left(90)
turtle.forward(50)
turtle.right(135)
turtle.pendown()
turtle.forward(50)
示例14: rightarm
def rightarm():
turtle.penup()
turtle.home()
turtle.left(90)
turtle.forward(120)
turtle.right(45)
turtle.pendown()
turtle.forward(50)
示例15: reg_bullet
def reg_bullet():
turtle.home()
turtle.setpos(0, -5)
turtle.begin_poly()
turtle.circle(5, None, None)
turtle.end_poly()
circ = turtle.get_poly()
turtle.register_shape('bullet', circ)