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


Python turtle.home函数代码示例

本文整理汇总了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()
开发者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


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