本文整理汇总了Python中turtle.hideturtle函数的典型用法代码示例。如果您正苦于以下问题:Python hideturtle函数的具体用法?Python hideturtle怎么用?Python hideturtle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hideturtle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"
示例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()
示例3: show_turtle
def show_turtle(turtle, x):
"""Do you want to see the turtle?"""
if show_turtle == 'yes':
turtle.showturtle()
else:
turtle.hideturtle()
示例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()
示例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...")
示例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
示例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()
示例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()
示例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()
示例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")
示例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)
示例12: setup
def setup():
turtle.hideturtle()
turtle.tracer(1e3,0)
turtle.left(90)
turtle.penup()
turtle.goto(0,-turtle.window_height()/2)
turtle.pendown()
示例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()
示例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()
示例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()