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


Python turtle.showturtle函数代码示例

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


在下文中一共展示了showturtle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loop

def loop(x,y):
    if -50<x<50 and -5<y<45:
        turtle.clear()
        play()
    else:
        turtle.showturtle()
        turtle.goto(x, y)
开发者ID:BCasaleiro,项目名称:Tic-tac-toe,代码行数:7,代码来源:Galo.py

示例2: show_turtle

def show_turtle(turtle, x):
    """Do you want to see the turtle?"""

    if show_turtle == 'yes':
        turtle.showturtle()
    else:
        turtle.hideturtle()
开发者ID:trarial,项目名称:PythonInteractiveTurtle,代码行数:7,代码来源:TurtleDesignerSecondDraft.py

示例3: rectangle

def rectangle(length, width, x = 0, y = 0, color = 'black', fill = False):
    import turtle
    turtle.showturtle()
    turtle.penup()
    turtle.goto(x,y)
    turtle.color(color)
    turtle.pendown()
    if fill == True:
        turtle.begin_fill()
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.left(90)
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.end_fill()
    else:
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
        turtle.left(90)
        turtle.forward(length)
        turtle.left(90)
        turtle.forward(width)
    turtle.hideturtle()
开发者ID:qrdean,项目名称:py,代码行数:26,代码来源:GraphicsAndPatternLibrary.py

示例4: 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

示例5: draw_path

    def draw_path(self, positions):
        '''
        Draws the path given by a position list
        '''

        def position_to_turtle(pos):
            '''Converts a maze position to a turtle position'''
            return (home_x + _DRAW_SIZE * pos[0], home_y - _DRAW_SIZE * pos[1])

        # Get maze size
        width, height = self.size

        # Prepare turtle
        home_x = (-(_DRAW_SIZE * width) / 2) + (_DRAW_SIZE / 2)
        home_y = ((_DRAW_SIZE * height) / 2) - (_DRAW_SIZE / 2)

        turtle.showturtle()
        turtle.pencolor(_DRAW_PATH)

        # Move to star
        turtle.penup()
        turtle.goto(home_x, home_y)
        turtle.pendown()

        # Draw the path
        for pos in positions:
            turtle.goto(position_to_turtle(pos))
开发者ID:jcowgill,项目名称:cs-work,代码行数:27,代码来源:maze_base.py

示例6: writeText

 def writeText(x, y, text, color ='black'):
     turtle.showturtle()
     turtle.color(color)
     turtle.penup()
     turtle.goto(x + .05*abs(x),y + .05*abs(y))
     turtle.pendown()
     turtle.write(text)
     turtle.setheading(0)
开发者ID:qrdean,项目名称:py,代码行数:8,代码来源:MyTurtle.py

示例7: _goto_coor

 def _goto_coor(self):
     loc = self.loc
     x_cor = self.x_cor
     y_cor = self.y_cor
     turtle = self.Turtle
     turtle.pu()
     turtle.goto(x_cor, y_cor)
     turtle.showturtle()
开发者ID:MiniMidgetMichael,项目名称:AI,代码行数:8,代码来源:AI_target.py

示例8: main

def main():
    angles = [36, 144, 144, 144, 144]
    t.showturtle()
    
    for i in range(5):
        t.left(angles[i])
        t.forward(300)
        
    t.done()
开发者ID:hmly,项目名称:liang-python,代码行数:9,代码来源:01-18_star.py

示例9: init

def init():
    turtle.setworldcoordinates(-WINDOW_WIDTH / 2, -WINDOW_WIDTH / 2,
                               WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2)
    turtle.up()
    turtle.setheading(0)
    turtle.hideturtle()
    turtle.title('Snakes')
    turtle.showturtle()
    turtle.setx(-225)
    turtle.speed(0)
开发者ID:yj29,项目名称:PythonAssignments,代码行数:10,代码来源:typography.py

示例10: main

def main():
    t.showturtle()
    pos = [[-45,0], [-45,-90], [45,0], [45,-90]]
    
    for i in range(4):
        t.penup()
        t.goto(pos[i])
        t.pendown()
        t.circle(45)
        
    t.done()
开发者ID:hmly,项目名称:liang-python,代码行数:11,代码来源:01-16_circles.py

示例11: chessboard

def chessboard(side, xstart = 0, ystart = 0, color = 'black', background = 'white'):
    import turtle
    turtle.speed(50)
    turtle.showturtle()
    turtle.penup()
    turtle.goto(xstart, ystart)
    turtle.right(45)
    squareSize = side/8
    for i in range(1,9):
        oddoreven = i % 2
        if oddoreven == 1:
            for k in range(0,4):
                
                turtle.color(color)
                turtle.begin_fill()
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.color(background)
                turtle.begin_fill()
                turtle.right(45)
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.right(45)
        else:
            for k in range(0,4):
                
                turtle.color(background)
                turtle.begin_fill()
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.color(color)
                turtle.begin_fill()
                turtle.right(45)
                turtle.circle(squareSize, steps = 4)
                turtle.end_fill()
                turtle.left(45)
                turtle.forward(squareSize*1.45)
                turtle.right(45)
        turtle.penup()
        turtle.goto(xstart, ystart+squareSize*1.45*i)
        turtle.pendown()
    turtle.penup()
    turtle.goto(xstart,ystart)
    turtle.color('black')
    turtle.pensize(5)
    turtle.pendown()
    turtle.circle(side*1.01, steps = 4)
开发者ID:qrdean,项目名称:py,代码行数:53,代码来源:GraphicsAndPatternLibrary.py

示例12: drawLine

def drawLine(x1, y1, x2, y2):
    turtle.showturtle()
    turtle.penup()
    # Point 1
    turtle.goto(x1, y1)
    turtle.pendown()
    turtle.write((x1,y1), font=('Calibri', 8))
    # Point 2
    turtle.goto(x2, y2)
    turtle.write((x2,y2), font=('Calibri', 8))
    turtle.hideturtle()
    turtle.done()
开发者ID:hmly,项目名称:liang-python,代码行数:12,代码来源:03-19_draw-line.py

示例13: runSimulation

def runSimulation(path, destination):
    turtle.up()
    turtle.delay(0)
    turtle.setposition(path[0].xloc, path[0].yloc)
    for node in path:
        turtle.pencolor("red")
        turtle.color("green", "orange")
        turtle.delay(100)
        turtle.showturtle()
        turtle.down()
        turtle.setposition(node.xloc, node.yloc) 
        drawRouter(node.label, node.xloc, node.yloc) 
        turtle.up()
    turtle.down()
开发者ID:garrettsparks,项目名称:Classwork,代码行数:14,代码来源:main.py

示例14: parallelogram

def parallelogram(s, color):#creates a single parallelogram
    turtle.showturtle()
    turtle.shape('turtle')
#    time.sleep(3)
    turtle.pensize(3)
    turtle.fillcolor(color)
    turtle.begin_fill()
    turtle.fd(s)
    turtle.left(45)
    turtle.fd(s)
    turtle.left(135)
    turtle.fd(s)
    turtle.left(45)
    turtle.fd(s)
    turtle.end_fill()
开发者ID:rzzzwilson,项目名称:Random-Stuff,代码行数:15,代码来源:test2.py

示例15: init

def init():
    """
    sets the width of window and initialise parameters
    :return:
    """

    t.setworldcoordinates(-WINDOW_WIDTH / 2, -WINDOW_WIDTH / 2,
                          WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2)
    t.up()
    t.setheading(0)
    t.hideturtle()
    t.title('Forest')
    t.showturtle()
    t.setx(-225)
    t.speed(0)
开发者ID:yj29,项目名称:PythonAssignments,代码行数:15,代码来源:forest.py


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