• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python turtle.home函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中turtle.home函数的典型用法代码示例。如果您正苦于以下问题:Python home函数的具体用法?Python home怎么用?Python home使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了home函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:jonobrien,项目名称:School_Backups,代码行数:33,代码来源:tic_tac_toe_finished.py


示例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) )
开发者ID:slott56,项目名称:HamCalc-2.1,代码行数:27,代码来源:logoclok.py


示例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
开发者ID:ernestojfcosta,项目名称:IPRP,代码行数:35,代码来源:grelha.py


示例4: at

def at(x, y):
    turtle.penup()
    turtle.home()
    turtle.forward(x)
    turtle.left(90)
    turtle.forward(y)
    turtle.pendown()
开发者ID:michaelmp,项目名称:python-lab,代码行数:7,代码来源:lab2.py


示例5: theStem

def theStem(stemLength=100):
	turtle.home()
	turtle.forward(25)
	turtle.left(90)
	turtle.pensize(4)
	turtle.color("green")
	turtle.forward(stemLength)
开发者ID:KrbAlmryde,项目名称:Homework,代码行数:7,代码来源:ISTA130_HW1b.py


示例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()
开发者ID:hubls,项目名称:p2_201611092,代码行数:7,代码来源:Turtle+Run+Game.py


示例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) 
开发者ID:joenco,项目名称:compiladorg,代码行数:30,代码来源:figuras.py


示例8: body

def body():
    turtle.penup()
    turtle.home()
    turtle.left(90)
    turtle.forward(50)
    turtle.pendown()
    turtle.forward(90)
开发者ID:csimpkins,项目名称:python-course,代码行数:7,代码来源:draw.py


示例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()
开发者ID:KrbAlmryde,项目名称:Homework,代码行数:25,代码来源:PlusFunction.py


示例10: drawAnswer

def drawAnswer(x, path) :
    initialize()
    drawB(x[0],x[1])
    for pos in path :
        drawP(pos)
    t.penup()
    t.home()
    sleep(2)
开发者ID:shihokambara,项目名称:gengo_joho_kadai_repository,代码行数:8,代码来源:knightdraw.py


示例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()
开发者ID:jeffrey276,项目名称:PythonGame,代码行数:8,代码来源:Project.py


示例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)
开发者ID:sbihel,项目名称:retrogames,代码行数:8,代码来源:walking.py


示例13: rightleg

def rightleg():
    turtle.penup()
    turtle.home()
    turtle.left(90)
    turtle.forward(50)
    turtle.right(135)
    turtle.pendown()
    turtle.forward(50)
开发者ID:csimpkins,项目名称:python-course,代码行数:8,代码来源:draw.py


示例14: rightarm

def rightarm():
    turtle.penup()
    turtle.home()
    turtle.left(90)
    turtle.forward(120)
    turtle.right(45)
    turtle.pendown()
    turtle.forward(50)
开发者ID:csimpkins,项目名称:python-course,代码行数:8,代码来源:draw.py


示例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)
开发者ID:cferr,项目名称:projetFusee,代码行数:8,代码来源:gravity.py


示例16: head

def head():
    turtle.penup()
    turtle.home()
    turtle.left(90)
    turtle.forward(140)
    turtle.right(90)
    turtle.pendown()
    turtle.circle(20)
开发者ID:csimpkins,项目名称:python-course,代码行数:8,代码来源:draw.py


示例17: dragon_curve_tiling

def dragon_curve_tiling():
    for heading in [0, 90, 180, 270]:
        t.penup()
        t.home()
        t.setheading(heading)
        changeColor()
        t.pendown()
        dragon_curve(iteration, size, swap=True)
开发者ID:TeachingKidsProgramming,项目名称:TeachingKidsProgramming.Python,代码行数:8,代码来源:dragon_curve_tiling.py


示例18: maketree

def maketree(name, scale, L):
	turtle.home()
	turtle.begin_poly()
	stack = [ (0, 0) ]
	maketree_r(stack, L, scale)
	turtle.end_poly()
	poly = turtle.get_poly()
	turtle.register_shape(name, poly)
开发者ID:sbihel,项目名称:retrogames,代码行数:8,代码来源:walking.py


示例19: makeground

def makeground():
	for i in range(GROUNDLEN-3, GROUNDLEN+9):
		turtle.home()
		turtle.begin_poly()
		turtle.fd(i)
		turtle.end_poly()
		name = 'gr%d' % i
		turtle.register_shape(name, turtle.get_poly())
		GROUND.append(name)
开发者ID:sbihel,项目名称:retrogames,代码行数:9,代码来源:walking.py


示例20: drawcircle1

def drawcircle1():
# this function draws the inner circle.
    turtle.right(90)
    turtle.forward(30)
    turtle.left(90)
    turtle.down()
    turtle.circle(30)
    turtle.up()
    turtle.home()
开发者ID:MathematicianVogt,项目名称:RIT,代码行数:9,代码来源:fourway_button.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python turtle.ht函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.hideturtle函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap