本文整理汇总了Python中turtle.ht函数的典型用法代码示例。如果您正苦于以下问题:Python ht函数的具体用法?Python ht怎么用?Python ht使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ht函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ejes
def ejes():
####################################
# Ejes Coordenados #
# los ejes x e y van de -150 a 150 #
####################################
turtle.delay(0)
turtle.ht()
turtle.speed(0)
turtle.pencolor('red')
turtle.down()
turtle.fd(301)
turtle.rt(90)
turtle.fd(1)
turtle.rt(90)
turtle.fd(300)
turtle.lt(90)
turtle.fd(300)
turtle.rt(90)
turtle.fd(1)
turtle.rt(90)
turtle.fd(300)
turtle.lt(90)
turtle.fd(300)
turtle.rt(90)
turtle.fd(1)
turtle.rt(90)
turtle.fd(300)
turtle.lt(90)
turtle.fd(300)
turtle.rt(90)
turtle.fd(1)
turtle.rt(90)
turtle.fd(300)
turtle.up()
turtle.pencolor('blue')
示例2: display
def display( self, text ):
"""Display the finished graphic until the window is closed.
Might be better to display until key click or mouse click.
"""
turtle.title( text )
turtle.ht()
示例3: draw_l
def draw_l(word):
turtle.up()
turtle.clear()
turtle.setposition(0, 0)
turtle.setheading(0)
turtle.bk(INITIAL_POS[0])
turtle.down()
turtle.st()
stack = []
for char in word:
if char == '0':
turtle.fd(SIZE[0])
if char == '1':
turtle.fd(SIZE[0])
if char == '[':
stack.append((turtle.position(), turtle.heading()))
turtle.lt(45)
if char == ']':
position, heading = stack.pop()
turtle.up()
turtle.setposition(position)
turtle.setheading(heading)
turtle.rt(45)
turtle.down()
turtle.ht()
示例4: drawBoard
def drawBoard():
global b
#actually draw the board :D
turtle.ht()
turtle.width(5)
turtle.up()
turtle.goto(-3*b/2.0,b/2.0)
turtle.down()
turtle.seth(0)
turtle.forward(3*b)
turtle.up()
turtle.goto(-3*b/2.0,-b/2.0)
turtle.down()
turtle.seth(0)
turtle.forward(3*b)
turtle.up()
turtle.goto(-b/2.0,3*b/2.0)
turtle.down()
turtle.seth(270)
turtle.forward(3*b)
turtle.up()
turtle.goto(b/2.0,3*b/2.0)
turtle.down()
turtle.seth(270)
turtle.forward(3*b)
示例5: turtle_init
def turtle_init():
turtle.ht()
turtle.up()
turtle.speed(0)
turtle.left(90)
turtle.backward(350)
turtle.down()
示例6: init_turtle
def init_turtle():
turtle.ht()
turtle.up()
turtle.speed(0)
turtle.setpos(-500, -300)
turtle.left(60)
turtle.colormode(255)
turtle.pencolor((150, 150, 0))
turtle.down()
示例7: ready
def ready(rad):
turtle.speed(0)
turtle.ht()
turtle.up()
turtle.goto(0,-rad)
turtle.down()
turtle.colormode(1)
turtle.bgcolor('black')
turtle.pensize(1.1)
示例8: pintar
def pintar(x, y):
##################################
# Función para Encender un Pixel #
##################################
turtle.delay(0)
turtle.speed(0)
turtle.ht()
turtle.up()
turtle.goto(2 * int(x), 2 * int(y))
turtle.down()
turtle.fd(0)
turtle.up()
示例9: init_engine
def init_engine(delay=_ENGINEDELAY):
'''
(Re)initializes the game engine. Only one game engine may exist
at any one time. The optional parameter specifies a delay added
to each game time step, in seconds; the value may be a floating
point number.
'''
global _e
_e = _E(delay)
turtle.pu()
turtle.ht()
turtle.clear()
示例10: __main__
def __main__():
turtle.ht()
nodes = []
while True:
numberOfNodes = int(raw_input("Number of nodes (Max = 8): "))
if numberOfNodes > 8 or numberOfNodes <= 1:
print "The amount of nodes must be a number between 2 and 8."
else:
drawCircles(numberOfNodes)
i = 1
while i <= numberOfNodes:
nodes = nodes + ["Q" + str(i)]
i += 1
break
labelNodes(numberOfNodes)
while True:
startingNode = str(raw_input("Starting node: "))
if startingNode in nodes:
entrance([-400 + 80 * nodes.index(startingNode), 20])
break
else:
print "That node does not exist please choose a node between Q1 and Q" + str(numberOfNodes) + "."
while True:
endingNodes = str(
raw_input("Accepting state (Enter all accepting states put a comma between them ex. Q1,Q3): ")
)
endingNodes = endingNodes.split(",")
valid = True
for x in endingNodes:
if x not in nodes:
valid = False
break
if valid == True:
for x in endingNodes:
final([-400 + 80 * nodes.index(x), 20])
break
else:
print "One of those nodes does not exist please try again"
addT = "Jonathan"
print "Transitions(Enter one transtion then press enter. After the last transition press enter twice. Format (StartingNode,Letter)=EndingNode *No spaces*)"
while True:
addT = str(raw_input())
if addT == "":
break
else:
new = transitions(addT)
if new[0] in nodes and new[2] in nodes:
addLine(nodes.index(new[0]), nodes.index(new[2]), new[1])
else:
print "Looks like their was an error with your format. Please try again."
saveImg()
示例11: disp
def disp(A, cellsize = 1 / 10.5):
turtle.clear()
turtle.shape("square")
turtle.penup()
turtle.speed(0)
turtle.shapesize(0.5, 0.5, 1)
turtle.ht()
top = len(A) / cellsize
left = -len(A[0]) / cellsize
for r in range(len(A)):
for c in range(len(A[r])):
if A[r][c]:
turtle.goto(c * 10.5 + left, top - r * 10.5)
turtle.stamp()
示例12: __init__
def __init__(self,pseudo,adv,*,x=600,y=400):
super().__init__(pseudo,adversaire = adv)
turtle.Screen().onkey(self.pleindre,'p')
turtle.Screen().onkey(self.rule,'j')
self.coord1 = None
self.coord2 = None
turtle.ht()
turtle.penup()
turtle.bgpic("interface.gif") #charge le fond d'écran
turtle.setup (width=x, height=y, startx=0, starty=0)
turtle.Screen().onkey(self.help,'m')
turtle.goto(-170,115)
turtle.write(self.adv,align="center",font=("Arial",25, "normal"))
turtle.goto(140,115)
turtle.write(pseudo,align="center", font=("Arial",25, "normal"))
示例13: hold
def hold(self):
""" holds the screen open until the user clicks or types 'q' """
# have the turtle listen for events
turtle.listen()
# hide the turtle and update the screen
turtle.ht()
turtle.update()
# have the turtle listen for 'q'
turtle.onkey( turtle.bye, 'q' )
# have the turtle listen for a click
turtle.onscreenclick( lambda x,y: turtle.bye() )
# start the main loop until an event happens, then exit
turtle.mainloop()
exit()
示例14: Sierpinsmod
def Sierpinsmod(size,mod,alto=1024,ancho=700,dx=4):
r=1.0*dx
pp=dx # Grueso de los puntos
turtle.colormode(1)
turtle.ht()
turtle.speed("fastest")
turtle.tracer(False)
turtle.penup()
turtle.home()
ox = -(turtle.window_width()/2)+2*dx
oy = (turtle.window_height()/2)-2*dx
P=Pascal(size,mod)
turtle.setpos(ox,oy)
turtle.dot(pp,clr(P[0][0],mod))
turtle.seth(90)
for d in range(1,2*size-1):
print("iniciando diagonal ",d),
if d< size:
initx=0 # Posiciones iniciales
inity=d
else:
initx = d-size+1
inity = size-1
turtle.setpos(ox+initx*dx-dx,oy-inity*dx-dx)
for k in range(initx,inity+1):
# Recorremos la diagonal de suma d
# Los puntos corresponden a (k, d-k)
turtle.right(90)
turtle.forward(dx)
turtle.left(90)
turtle.forward(dx)
t=P[k][d-k]
if t > 0:
turtle.dot(pp, clr(t,mod))
if d % 20 ==0: turtle.update()
示例15: illustrate
def illustrate(self, color="red"):
# if the tree is empty, exit program
if self.is_empty():
print("Empty")
return
# set turtle settings
turtle.ht()
turtle.pu()
turtle.speed(0)
# move turtle to near top of string
turtle.goto(0, 250)
# set color of the numbers on the nodes
self.color = color
# begin drawing the tree
self.help_illustrate(self.root, turtle)