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

Python turtle.hideturtle函数代码示例

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

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



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

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


示例2: turtleProgram

def turtleProgram():
    import turtle
    import random
    global length
    turtle.title("CPSC 1301 Assignment 4 MBowen") #Makes the title of the graphic box
    turtle.speed(0) #Makes the turtle go rather fast
    for x in range(1,(numHex+1)): #For loop for creating the hexagons, and filling them up
        turtle.color(random.random(),random.random(),random.random()) #Defines a random color
        turtle.begin_fill()
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.forward(length)
        turtle.left(60)
        turtle.end_fill()
        turtle.left(2160/(numHex))
        length = length - (length/numHex) #Shrinks the hexagons by a small ratio in order to create a more impressive shape
    turtle.penup()   
    turtle.goto(5*length1/2, 0) #Sends turtle to a blank spot
    turtle.color("Black")
    turtle.hideturtle()
    turtle.write("You have drawn %d hexagons in this pattern." %numHex) #Captions the turtle graphic
    turtle.mainloop()
开发者ID:trsman44,项目名称:Fall-2015,代码行数:30,代码来源:MatthewBowenA4.py


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


示例4: Run

def Run():
    #bounds
    nearRange = [0, 50]
    farRange = [50, 200]
    frusHL = 100

    #Logic
    nearDist = random.uniform(nearRange[0], nearRange[1])
    farDist = random.uniform(farRange[0], farRange[1])
    d = frusHL * 2
    an = nearDist
    af = farDist
    b = (d*d + af*af - an*an) / (2 * d)
    radius = math.sqrt(b*b + an*an)
    originY = -frusHL + b

    #text.insert('end', 'Origin: %d\n' % originY)

    #Render
    turtle.clear()
    turtle.hideturtle()
    turtle.tracer(0, 0)
    turtle.penup()
    turtle.goto(-farDist, frusHL)
    turtle.pendown()
    turtle.goto(-nearDist, -frusHL)
    turtle.goto(nearDist, -frusHL)
    turtle.goto(farDist, frusHL)
    turtle.goto(-farDist, frusHL)
    turtle.penup()
    DrawCircle(0, originY, radius);
    turtle.update()
开发者ID:int-Frank,项目名称:DgLib,代码行数:32,代码来源:FrustumMinBoungingSphere.py


示例5: main

def main():
    depth = int(input("Enter depth(recursion) of tree:"))
    length = int(input("Enter total height of the tree:"))

    range_of_bushiness = 0
    while range_of_bushiness == 0:
        bushiness = float(input("Enter bushiness ranging from 0.1 - 1.0 :"))
        if 0.1 <= bushiness <= 1.0:
            range_of_bushiness = 1
        else:
            print("You entered the invalid value of bushiness please enter a valid value between 0.1 and 1.0")

    range_of_leafiness = 0
    while range_of_leafiness == 0:
        leafiness = float(input("Enter leafiness ranging from 0.1 - 1.0 :"))
        if 0.1 <= leafiness <= 1.0:
            range_of_leafiness = 1
        else:
            print("You entered the invalid value of leafiness, please enter a valid value between 0.1 and 1.0")

    init()
    drawTree(depth, length / 3, bushiness, leafiness)
    """turtle.done()"""
    turtle.hideturtle()
    input("Hit enter to close...")
开发者ID:yj29,项目名称:PythonAssignments,代码行数:25,代码来源:modified.py


示例6: drawBoard

def drawBoard(b):
    #set up window
    t.setup(600,600)
    t.bgcolor("dark green")
    
    #turtle settings
    t.hideturtle()
    t.speed(0)
    
    num=len(b)
    side=600/num
    xcod=-300
    ycod=-300
    for x in b:
        for y in x:
            if(y> 0):
                drawsquare(xcod,ycod,side,'black')
            if(y< 0):
                drawsquare(xcod,ycod,side,'white')
            if(y==0):
                drawsquare(xcod,ycod,side,'dark green')
            
            xcod=xcod+side
        xcod=-300
        ycod=ycod+side
开发者ID:gK996,项目名称:Othello,代码行数:25,代码来源:project2.py


示例7: main

def main():
    turtle.setup(800, 350, 200, 200)
    turtle.penup()
    turtle.fd(-300)
    turtle.pensize(5)
    drawDate(datetime.datetime.now().strftime('%Y%m%d'))
    turtle.hideturtle()
开发者ID:BrandonSherlocking,项目名称:python_document,代码行数:7,代码来源:数码管.py


示例8: tree

def tree(theta_one, theta_two, branchLen, divide_one, divide_two, tt, pen, color_one, color_two):
	
	# set attribute
	tt.pensize(pen)
	
	# base case
	if branchLen < divide_two:
		return
    
    
    # pick colors for drawing
	select_color(tt, branchLen, divide_one, divide_two, color_one, color_two)
	
	# recursion starts from here
	tt.forward(branchLen)
	tt.right(theta_one)
	tree(theta_one, theta_two, branchLen*0.75, divide_one, divide_two, tt, pen * 0.8, color_one, color_two)
	tt.left(theta_one + theta_two)
	tree(theta_one, theta_two, branchLen*0.65, divide_one, divide_two, tt, pen * 0.8, color_one, color_two)
	tt.right(theta_two)

    # call second time to prevent over-coloring
	select_color(tt, branchLen, divide_one, divide_two, color_one, color_two)

	# return to instance
	tt.backward(branchLen)
	turtle.hideturtle()
开发者ID:LiChangNY,项目名称:fun_projects,代码行数:27,代码来源:life_of_a_tree.py


示例9: main

def main():
    board_ac=[10,2,3,4,5,6,7,8,9]
    turtle.screensize(300,300)
    turtle.hideturtle()    
    go_to(0,0,0)
    board()
    #players()
    win=0
    n_jogada=0
    
    player1=input('Player 1:\t')
    player2=input('Player 2:\t')     
    
    while win!=1:
        n_jogada += 1
        if check(board_ac) == True:
            if (-1)**n_jogada == -1:
                win=1
                print(player2, 'Ganhou!')
                
            else:
                win=1
                print(player1, 'Ganhou!')
        else:
            player_turn(n_jogada, board_ac)
    turtle.exitonclick()
开发者ID:joaomiguelsa,项目名称:Jogo-do-Galo,代码行数:26,代码来源:3+em+linha.py


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


示例11: drawBar

def drawBar():
	turtle.penup()
	turtle.hideturtle()
	xAxis=-600
	yAxis=-200
	turtle.goto(xAxis,yAxis)
	turtle.color("green")
	turtle.fillcolor("green")
	failTurtle=turtle.Turtle()
	failTurtle.hideturtle()
	failTurtle.penup()
	failTurtle.goto(xAxis + 50,yAxis)
	failTurtle.color("red")
	failTurtle.fillcolor("red")
	drawAxis(xTurtle, False)
	drawAxis(yTurtle, True)
	yNoPassTurtle.hideturtle()
	yNoFailTurtle.hideturtle()

	for i in range(len(studentsYear)):
		studenPerYear = studentsYear[i]
		passNo=int(studenPerYear.passNum)*5
		failNo=int(studenPerYear.failNum)*5
		graphPlot(turtle,passNo,i,yNoPassTurtle,False, studenPerYear)
		graphPlot(failTurtle,failNo,i,yNoFailTurtle,True,studenPerYear)
		xAxis=xAxis+150
		turtle.goto(xAxis,yAxis)
		failTurtle.goto(xAxis+50,yAxis)
开发者ID:nijajojen,项目名称:RemindMeApp,代码行数:28,代码来源:Graph.py


示例12: setup

def setup():
    turtle.hideturtle()
    turtle.tracer(1e3,0)
    turtle.left(90)
    turtle.penup()
    turtle.goto(0,-turtle.window_height()/2)
    turtle.pendown()
开发者ID:EVGENIY2015,项目名称:cbm,代码行数:7,代码来源:tree.py


示例13: drawSootSprite

def drawSootSprite(N, R):
    # reset direction
    turtle.reset()
    # draw star
    drawStar(N, R)
    # draw body
    turtle.dot(0.8*2*R)
    # draw right eyeball
    turtle.fd(0.2*R)
    turtle.dot(0.3*R, 'white')
    # draw right pupil
    turtle.pu()
    turtle.bk(0.1*R)
    turtle.pd()
    turtle.dot(0.05*R)
    turtle.pu()
    # centre
    turtle.setpos(0, 0)
    # draw left eyeball
    turtle.bk(0.2*R)
    turtle.pd()
    turtle.dot(0.3*R, 'white')
    # draw left pupil
    turtle.pu()
    turtle.fd(0.1*R)
    turtle.pd()
    turtle.dot(0.05*R)

    turtle.hideturtle()
开发者ID:circulocity,项目名称:tp10,代码行数:29,代码来源:sootsprite.py


示例14: rysuj

def rysuj():
    turtle.tracer(0, 0)  # wylaczenie animacji co KROK, w celu przyspieszenia
    turtle.hideturtle()  # ukrycie glowki zolwika
    turtle.penup() # podnosimy zolwia, zeby nie mazal nam linii podczas ruchu

    ostatnie_rysowanie = 0  # ile kropek temu zostal odrysowany rysunek

    for i in xrange(ILE_KROPEK):
        # losujemy wierzcholek do ktorego bedziemy zmierzac	
        do = random.choice(WIERZCHOLKI)
        # bierzemy nasza aktualna pozycje 
        teraz = turtle.position()
        # ustawiamy sie w polowie drogi do wierzcholka, ktorego wczesniej obralismy
        turtle.setpos(w_polowie_drogi(teraz, do))
        # stawiamy kropke w nowym miejscu
        turtle.dot(1)
        ostatnie_rysowanie += 1
        if ostatnie_rysowanie == OKRES_ODSWIEZENIA:
            # postawilismy na tyle duzo kropek, zeby odswiezyc rysunek
            turtle.update()
            ostatnie_rysowanie = 0

    pozdrowienia()

    turtle.update()
开发者ID:samorajp,项目名称:kompresja_fraktalna,代码行数:25,代码来源:w_polowie_drogi.py


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


示例16: viewer

def viewer(dna):
	'''Display ORFs and GC content for dna.'''
   
	dna = dna.upper()      # make everything upper case, just in case
   
	t = turtle.Turtle()
	turtle.setup(1440, 240)                  # make a long, thin window
	turtle.screensize(len(dna) * 6, 200)     # make the canvas big enough to hold the sequence
	# scale coordinate system so one character fits at each point
	setworldcoordinates(turtle.getscreen(), 0, 0, len(dna), 6)
	turtle.hideturtle()
	t.speed(0)
	t.tracer(100)
	t.hideturtle()
   
	# Draw the sequence across the bottom of the window.
	t.up()
	for i in range(len(dna)):
		t.goto(i, 0)
		t.write(dna[i],font=("Helvetica",8,"normal"))
      
	# Draw bars for ORFs in forward reading frames 0, 1, 2.
	# Draw the bar for reading frame i at y = i + 1.
	t.width(5)              # width of the pen for each bar
	for i in range(3):
		orf(dna, i, t)
      
	t.width(1)              # reset the pen width
	gcFreq(dna, 20, t)      # plot GC content over windows of size 20
      
	turtle.exitonclick()
开发者ID:BazzalSeed,项目名称:Python_Practices,代码行数:31,代码来源:temp.py


示例17: drawCloud

def drawCloud(words, num = 20):
    """ Draws a wordcloud with 20 random words, sized by frequency found in 
    the WORDS dictionary. """
    t.reset()
    t.up()
    t.hideturtle()
    topCounts = sorted([words[word] for word in list(words.keys()) if len(word) > 3])
    largest = topCounts[0]
    normalized_counts = {}
    for item in list(words.keys()):
        if len(item) > 3:
            newSize = int(float(words[item]) / largest * 24)
            normalized_counts[item] = newSize
    
    size = t.screensize()
    width_dim = (int(-1 * size[0] / 1.5), int(size[0] / 2))
    height_dim = (int(-1 * size[1] / 1.5), int(size[1] / 1.5))
    

    for item in random.sample(list(normalized_counts.keys()), num):
        t.goto(random.randint(*width_dim), random.randint(*height_dim))
        t.color(random.choice(COLORS))
        try:
            t.write(item, font = ("Arial", int(normalized_counts[item]), "normal"))
        except:
            try:
                t.write(str(item, errors = 'ignore'), font = ("Arial", int(normalized_counts[item]), "normal"))
            except:
                pass
开发者ID:cs10,项目名称:twitter,代码行数:29,代码来源:wordcloud.py


示例18: turtlePrint

def turtlePrint(board, width, height):
    turtle.hideturtle()
    turtle.speed(0)
    turtle.penup()
    turtle.goto(-210, -60)
    turtle.pendown()
    turtle.goto(20*width-210, -60)
    turtle.goto(20*width-210, 20*height-60)
    turtle.goto(-210, 20*height-60)
    turtle.goto(-210, -60)
    turtle.penup()

    for y in xrange(height):
        for x in xrange(width):
            turtle.penup()
            turtle.goto(20*x-200,20*y-50)
            turtle.pendown()
            if board[x][y] is 1:
                turtle.pencolor("green")
                turtle.dot(10)
                turtle.pencolor("black")
            elif board[x][y] is 2:
                turtle.dot(20)
            elif board[x][y] is 3:
                turtle.pencolor("red")
                turtle.dot(10)
                turtle.pencolor("black")
            elif board[x][y] is 8:
                turtle.pencolor("blue")
                turtle.dot()
                turtle.pencolor("black")

    turtle.exitonclick()
开发者ID:mrton,项目名称:A_Star,代码行数:33,代码来源:A_Star.py


示例19: main

def main():
    """
    Call various function for drawing various English character and space between them.
    :pre: (relative) pos (X,Y), heading (east), up
    :post: (relative) pos (X+26/5*length+,Y), heading (east), up
    :return: None

    """
    length = int(input("Enter the font size(for best fit on screen give 50): "))
    init()
    drawC(length)
    drawSpace(length / 5, 0)
    drawO(length)
    drawSpace(length / 5, 0)
    drawL(length)
    drawSpace(length / 5, 0)
    drawD(length)
    drawSpace(length / 5, 0)
    drawP(length)
    drawSpace(length / 5, 0)
    drawL(length)
    drawSpace(length / 5, 0)
    drawA(length)
    drawSpace(length / 5, 0)
    drawY(length)
    drawSpace(length / 5, 0)
    drawS(length)
    turtle.hideturtle()
    # drawO(length)
    input("press enter to close...")
开发者ID:deepaksharma36,项目名称:Python-Assignements,代码行数:30,代码来源:typography.py


示例20: __init__

    def __init__(self, length=10, angle=90, colors=None, lsystem=None):
        import turtle
        self.length = length
        self.angle = angle
        if colors is None:
            self.colors = ['red', 'green', 'blue', 'orange', 'yellow', 'brown']
        if lsystem is not None:
            self.lsystem(lsystem)

        # draw number
        self.ith_draw = 0

        # origin of next draw
        self.origin = [0, 0]

        # bounding_box
        self._box = 0, 0, 0, 0


        # turtle head north and positive angles is clockwise
        turtle.mode('world')
        turtle.setheading(90)
        turtle.speed(0) # fastest
        turtle.hideturtle()
        turtle.tracer(0, 1)
	
        # set pencolor
        self.pencolor()
开发者ID:masterzu,项目名称:pylsys,代码行数:28,代码来源:pylsys.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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