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

Python turtle.done函数代码示例

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

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



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

示例1: draw

 def draw(self):
     turtle.forward(self.radius)
     turtle.left(90)
     turtle.circle(self.radius, extent=self.angle)
     turtle.left(90)
     turtle.forward(self.radius)
     turtle.done()
开发者ID:tbemsi,项目名称:Intro-Python-AIMS,代码行数:7,代码来源:objects.py


示例2: init

def init():
    global totalWood
    global maxHeight
    trees = int(input("How many trees in your forest?"))
    house = input("Is there a house in the forest (y/n)?")
    turtle.penup()
    turtle.setposition(-330, -100)
    if(trees < 2 and house == "y"):
        print("we need atleast two trees for drawing house")
        turtle.done()
    else:
        position_of_house = random.randint(1, trees - 1)
        counter = 1
        house_drawn = 0
        while counter <= trees :
            if counter - 1 == position_of_house and house_drawn == 0:
                y = drawHouse(100)
                house_drawn = 1
                totalWood = totalWood + y
                spaceBetween(counter, trees)
            else:
                type_of_tree = random.randint(1, 3)
                wood, height = drawTrees(type_of_tree)
                spaceBetween(counter, trees)
                totalWood = totalWood + wood
                counter = counter + 1
                if height > maxHeight:
                    maxHeight = height

    turtle.penup()
    draw_star(maxHeight)
    turtle.hideturtle()
    input("Press enter to exit")
开发者ID:RIT-2015,项目名称:CPS,代码行数:33,代码来源:draw_image.py


示例3: main

def main():
    bob = turtle.Turtle()
    turtle.title('Sun Figure')
    turtle.setup(800, 800, 0, 0)
    bob.speed(0)
    bobMakesASun(bob, 1, 'purple')
    turtle.done()
开发者ID:enterth3r4in,项目名称:Shapes-,代码行数:7,代码来源:Shapes.py


示例4: plot

	def plot(self, node1, node2, debug=False):
		"""Plots wires and intersection points with python turtle"""
		tu.setup(width=800, height=800, startx=0, starty=0)
		tu.setworldcoordinates(-self.lav, -self.lav, self.sample_dimension+self.lav, self.sample_dimension+self.lav)
		tu.speed(0)
		tu.hideturtle()
		for i in self.index:
			if debug:
				time.sleep(2)   # Debug only
			tu.penup()
			tu.goto(self.startcoords[i][0], self.startcoords[i][1])
			tu.pendown()
			tu.goto(self.endcoords[i][0], self.endcoords[i][1])
		tu.penup()
		if self.list_of_nodes is None:
			intersect = self.intersections(noprint=True)
		else:
			intersect = self.list_of_nodes
		tu.goto(intersect[node1][0], intersect[node1][1])
		tu.dot(10, "blue")
		tu.goto(intersect[node2][0], intersect[node2][1])
		tu.dot(10, "blue")
		for i in intersect:
			tu.goto(i[0], i[1])
			tu.dot(4, "red")
		tu.done()
		return "Plot complete"
开发者ID:jzmnd,项目名称:nw-network-model,代码行数:27,代码来源:nwnet.py


示例5: main

def main():

    # want to edit the global copy
    global board

    # print out the "Apocalypse" text
    print("""
       (                         (
       )\                      ) )\(             (
    ((((_)(  `  )  (    (  ( /(((_)\ ) `  )  (   ))\\
     )\ _ )\ /(/(  )\   )\ )(_) )_(()/( /(/(  )\ /((_)
     (_)_\(_|(_)_\((_) ((_| (_)_| |(_)|(_)_\((__|__))
      / _ \ | '_ \) _ \/ _|/ _` | | || | '_ \|_-< -_)
     /_/ \_\| .__/\___/\__|\__,_|_|\_, | .__//__|___|
            |_|                    |__/|_|
        """)
    print("Welcome to Apocalypse!!\nThis is a simultaneous turn game which is based upon rules of chess\n")
    draw_board()
    penaltyCount()

    # bind the event handler
    screen.onclick(clicky)
    screen.onkeyrelease(save_state, "s")
    screen.onkeyrelease(load_state, "l")

    screen.listen()
    turtle.done()
开发者ID:Step7750,项目名称:Apocalypse,代码行数:27,代码来源:task_8_apocalypse.py


示例6: main

def main():
    bob = turtle.Turtle()

    bob.speed(20)

    theta = 137.508
    a = 1
    b = 1
    c = 1
    #radius = c*theta**0.5

    for r in range(500):
        radius = a + b*r**(1/c)
        # red = r/500.0
        # gre = r/500.0
        # blu = r/500.0
        # if r%3 == 0:
        #     bob.pencolor((1,1-gre,0))
        # elif r%3 == 1:
        #     bob.pencolor((1,1,0))
        # else:
        #     bob.pencolor((1,gre,blu))
        bob.dot()
        bob.penup()
        bob.left(theta)
        bob.forward(radius)

    turtle.done()
开发者ID:Rubalicious,项目名称:PredictionProject,代码行数:28,代码来源:vogelsModel.py


示例7: draw_table

def draw_table(dimension: int, side: int, turtle: Turtle, x_coord: int, y_coord: int) -> None:
    fill = False

    for i in range(dimension ** 2):
        if i % dimension == 0:
            y_coord -= side
            turtle.penup()
            turtle.setpos(x_coord, y_coord)
            turtle.pendown()
            fill = fill != (dimension % 2 == 0)

        if fill:
            turtle.begin_fill()

        for _ in range(4):
            turtle.forward(side)
            turtle.right(90)

        if turtle.filling():
            turtle.end_fill()

        turtle.forward(side)

        fill = not fill

    done()
开发者ID:wencakisa,项目名称:Softuni-Python3,代码行数:26,代码来源:chess.py


示例8: draw_figures

def draw_figures(area: Number):
    """
    Plots figures of the same area
    :param area: Area of figures
    :return:Plot of figures
    """
    begin_fill()
    turtle.right(45)
    turtle.forward(sqrt(area))
    turtle.right(90)
    turtle.forward(sqrt(area))
    turtle.right(90)
    turtle.forward(sqrt(area))
    turtle.right(90)
    turtle.forward(sqrt(area))
    i = 0
    while (i < 4):
        turtle.forward(sqrt(area))
        turtle.left(90)
        i = i+1
    turtle.circle(sqrt(area/pi))
    turtle.forward(sqrt(2*area))
    turtle.left(135)
    turtle.forward(sqrt(2)*sqrt(2*area))
    turtle.left(135)
    turtle.forward(sqrt(2*area))

    turtle.done()
开发者ID:tbemsi,项目名称:Intro-Python-AIMS,代码行数:28,代码来源:Turtle_test.py


示例9: main

def main(argv):
  user_file = ""

  # User GetOpt to Pull File from Command Line
  try:
    opts, args = getopt.getopt(argv,"hi:",["ifile="])
  except getopt.GetoptError:
    print("name-strip.py -i <input_file>")
    sys.exit(2)
  for opt, arg in opts:
    if opt in ("-h", "--help"):
      print("name-strip.py HELP\n\t-i <input_file>\t selects input file csv to interpret as map")
      sys.exit()
    elif opt in ("-i", "--ifile"):
      user_file = arg

  # Quit if no File Given
  if user_file == "":
    print("No file entered. Program terminating.")
    sys.exit()

  # Set Up CSV Reader
  mapReader = csv.reader(open(user_file, newline=''), delimiter=',', quotechar='|')

  # Iterate Through CSV
  for map_item in mapReader:
    #print("Map Item:", map_item)
    if map_item[0] == "c":
      create_city(map_item)
    else:
      create_road(map_item)

  turtle.hideturtle()
  turtle.done()
开发者ID:emersonp,项目名称:turtle-map,代码行数:34,代码来源:turtle-map.py


示例10: draw_triangle

def draw_triangle(l):
    i=0
    while(i<3):
        turtle.forward(l)
        turtle.left(120)
        i=i+1
    turtle.done()
开发者ID:gesesew,项目名称:Gesesew-Reta,代码行数:7,代码来源:matplot.py


示例11: draw_pyramid

def draw_pyramid(side: Number):
    """
    Plots a pyramid using turtle
    :param side: length of side
    :return: Plot of pyramid
    """
    turtle.forward(side)
    turtle.left(45)
    turtle.forward(side)
    turtle.left(135)
    turtle.forward(side)
    turtle.left(45)
    turtle.forward(side)
    turtle.goto(0, 0)
    turtle.penup()
    turtle.goto(0, 0)
    turtle.pendown()
    turtle.goto(side/2, 200)
    turtle.penup()
    turtle.goto(side, 0)
    turtle.pendown()
    turtle.goto(side/2, 200)
    turtle.penup()
    turtle.goto(side*cos(pi/4), side*sin(pi/4))
    turtle.pendown()
    turtle.goto(side/2, 200)
    turtle.penup()
    turtle.goto(side*(1+cos(pi/4)), side*sin(pi/4))
    turtle.pendown()
    turtle.goto(side/2, 200)
    turtle.done()
开发者ID:tbemsi,项目名称:Intro-Python-AIMS,代码行数:31,代码来源:Turtle_test.py


示例12: main

def main():
    turtle = Turtle()
    turtle.speed(0)
    turtle.home()
    turtle.left(90)
    drawTree(turtle, 8, 150)
    done()
开发者ID:yj29,项目名称:PythonAssignments,代码行数:7,代码来源:class9thsept.py


示例13: draw_regular_hexagon

def draw_regular_hexagon(l):
    i=0
    while(i<6):
        turtle.forward(l)
        turtle.left(60)
        i=i+1
    turtle.done()
开发者ID:gesesew,项目名称:Gesesew-Reta,代码行数:7,代码来源:matplot.py


示例14: draw

 def draw(self):
     for i in range(0,2):
         turtle.forward(self.length)
         turtle.left(90)
         turtle.forward(self.width)
         turtle.left(90)
     turtle.done()
开发者ID:ddamuliram,项目名称:Mahadi-Ddamulira,代码行数:7,代码来源:shapes.py


示例15: printTreeGraphic

def printTreeGraphic(brotherList):
    t = turtle.Turtle()
    setRoot()
    distX = 110
    distY = 110
    global mybox
    for b in brotherList:
        mybox = Card((b.column*distX,150-(b.row*distY)), 180, 60)
        if b.status == 1:
            mybox.setColor("#00a0df")
            mybox.setTextColor("white")
        else:
            mybox.setColor("white")
            mybox.setTextColor("black")
            
        mybox.setTilt(30)
        mybox.drawCard(b)


    ## Save ##
    #t.getscreen().getcanvas().postscript(file = "t1.eps")

    ## END ##
    turtle.done()
    return
开发者ID:AmarBhatt,项目名称:GreekFamilyTree,代码行数:25,代码来源:FamilyTree.py


示例16: drawLines

def drawLines(line_arr):
    turt = turtle.Turtle()
    turtle.shape("blank")
    # draws each line in the line_arr
    for line in line_arr:
        draw_single_line(line, turt)
    turtle.done()
开发者ID:PowerCouple,项目名称:Fractals,代码行数:7,代码来源:frac.py


示例17: main

def main():

    
    turtle.forward(100)
    turtle.right(90)
    turtle.forward(50)
    turtle.right(90)
    turtle.forward(100)
    turtle.right(90)
    turtle.forward(50)
    turtle.left(135)
    turtle.forward(50)
    turtle.left(45)
    turtle.forward(50)
    turtle.right(270)
    turtle.forward(100)
    turtle.left(45)
    turtle.forward(50)
    turtle.left(45)
    turtle.forward(50)
    turtle.left(135)
    turtle.forward(50)
    turtle.right(45)
    turtle.forward(100)
    turtle.forward(-100)
    turtle.left(90)
    turtle.forward(50)
    turtle.right(50)
    turtle.right(40)
    turtle.forward(100)
    turtle.right(135)
    turtle.forward(50)
    turtle.done()
开发者ID:amZotti,项目名称:Python-challenges,代码行数:33,代码来源:1.20.py


示例18: draw_figures

def draw_figures(figures):
    for figure in figures:
        t = Turtle()
        t.speed('slow')
        figure.draw_figure(t)

    done()
开发者ID:wencakisa,项目名称:Python-Dev,代码行数:7,代码来源:draw.py


示例19: main

def main():
    # to display the degree sign when printing results
    deg = u'\N{DEGREE SIGN}'

    turtle.setup(500, 500)                   # make window set size
    win = turtle.Screen()                    # refer to the screen as win
    win.title( "Triangles and Angles!")         # change the window title
    win.bgcolor( "#D3D3D3")               # change background color

    # get 3 X,Y coords from the user using eval( input())
    x1, y1, x2, y2, x3, y3 = eval( input( "Give 3 points: [e.g. 20, 20, 100, 200, 20, 200]  "))

    # compute the distances of all points
    a = distance( x1, y1, x2, y2)
    b = distance( x2, y2, x3, y3)
    c = distance( x1, y1, x3, y3)

    # round off 
    d1 = round( a * 100) / 100.0
    d2 = round( b * 100) / 100.0
    d3 = round( c * 100) / 100.0

    # make 3 seperate calls to determine_angle to find all angles opposite their sides
    angle_x = determine_angle( a,b,c)
    angle_y = determine_angle( b,c,a)
    angle_z = determine_angle( c,b,a)
    print( "The angles of the triangle are:")
    print( "\tAngle A: {:.2f}{}  \n\tAngle B: {:.2f}{}  \n\tAngle C: {:.2f}{}".format( angle_x,deg,angle_y,deg,angle_z,deg),end='\n\n')
    
    # draw the grid for the layout and referencing of plots
    draw_grid()
    draw_line( x1, y1, x2, y2, x3, y3, angle_x, angle_y, angle_z)
    
    turtle.done()
开发者ID:silentShadow,项目名称:CSC101,代码行数:34,代码来源:compute_angles_redux.py


示例20: main

def main():
    """ The main function, which creates a turtle and uses it to draw a happy robot
    :return: None
    """
    t = turtle.Turtle()

    body = [Square(0, 0, 200)]
    head = [Circle(0, 200, 100),
            Circle(50, 230, 20),
            Circle(-50, 230, 20),
            Triangle(50, 170, 0, 150, -50, 170),
            Triangle(40, 300, 0, 340, -40, 300)
            ]
    arms = [Rectangle(150, 100, 100, 20, 10),
            Rectangle(200, 150, 100, 20, 70),
            Rectangle(-150, 80, 100, 20, 10),
            Rectangle(-200, 30, 100, 20, 70)
            ]
    legs = [Rectangle(100, -200, 20, 200, 5),
            Rectangle(-100, -200, 20, 200, -5)
            ]

    robot = body + arms + legs + head

    for shape in robot:
        shape.draw(t)

    t.hideturtle()
    turtle.done()
开发者ID:JLASanders,项目名称:comp120-tinkering-graphics,代码行数:29,代码来源:robot.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python turtle.dot函数代码示例发布时间:2022-05-27
下一篇:
Python turtle.colormode函数代码示例发布时间: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