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


Python turtle.done函数代码示例

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


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


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