本文整理汇总了Python中turtle.pendown函数的典型用法代码示例。如果您正苦于以下问题:Python pendown函数的具体用法?Python pendown怎么用?Python pendown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pendown函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawP
def drawP(size):
turtle.setheading(90)
turtle.penup()
turtle.forward(size*1.5);
turtle.pendown()
turtle.forward(size*0.5);
drawSemi(size, direction="right", degrees=336, colour="black")
示例2: draw_circle
def draw_circle(x,y):
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
示例3: draw
def draw(cmds, size=2): #output tree
stack = []
for cmd in cmds:
if cmd=='F':
turtle.forward(size)
elif cmd=='-':
t = random.randrange(0,7,1)
p = ["Red","Green","Blue","Grey","Yellow","Pink","Brown"]
turtle.color(p[t])
turtle.left(15) #slope left
elif cmd=='+':
turtle.right(15) #slope right
t = random.randrange(0,7,1) #рандомная пер. для цвета
p = ["Red","Green","Blue","Grey","Yellow","Pink","Brown"] #ряд цветов
turtle.color(p[t]) #выбор цвета из ряда
elif cmd=='X':
pass
elif cmd=='[':
stack.append((turtle.position(), turtle.heading()))
elif cmd==']':
position, heading = stack.pop()
turtle.penup()
turtle.setposition(position)
turtle.setheading(heading)
turtle.pendown()
turtle.update()
示例4: entrance
def entrance(pointOne):
turtle.goto(pointOne[0], pointOne[1] + 36)
turtle.setheading(270)
turtle.pendown()
turtle.forward(15)
turtle.penup()
drawArrows()
示例5: rectangle
def rectangle(length = 50, width = 30, x = 0, y = 0, color = 'black', fill = False):
turtle.pensize(3)
turtle.speed('fastest')
turtle.hideturtle()
if fill == True:
turtle.color(color)
for i in range(width):
turtle.setposition(x, (y+i))
turtle.pendown()
turtle.setposition((x+length), (y+i))
turtle.penup()
else:
turtle.penup()
turtle.goto(x,y)
turtle.color(color)
turtle.pendown()
turtle.forward(length)
turtle.left(90)
turtle.forward(width)
turtle.left(90)
turtle.forward(length)
turtle.left(90)
turtle.forward(width)
turtle.left(90)
turtle.penup()
return
示例6: at
def at(x, y):
turtle.penup()
turtle.home()
turtle.forward(x)
turtle.left(90)
turtle.forward(y)
turtle.pendown()
示例7: draw_star
def draw_star(size, color):
turtle.pendown()
turtle.begin_fill()
turtle.color(1,1,1)
turtle.forward(2.5)
turtle.left(size)
turtle.forward(2.5)
turtle.right(144)
turtle.forward(2.5)
turtle.left(size)
turtle.forward(2.5)
turtle.right(144)
turtle.forward(2.5)
turtle.left(size)
turtle.forward(2.5)
turtle.right(144)
turtle.forward(2.5)
turtle.left(size)
turtle.forward(2.5)
turtle.right(144)
turtle.forward(2.5)
turtle.left(size)
turtle.forward(2.5)
turtle.right(144)
turtle.end_fill()
turtle.penup()
示例8: main
def main():
ap = ArgumentParser()
ap.add_argument('--speed', type=int, default=10,
help='Number 1-10 for drawing speed, or 0 for no added delay')
ap.add_argument('program')
args = ap.parse_args()
for kind, number, path in parse_images(args.program):
title = '%s #%d, path length %d' % (kind, number, path.shape[0])
print(title)
if not path.size:
continue
pen_up = (path==0).all(axis=1)
# convert from path (0 to 65536) to turtle coords (0 to 655.36)
path = path / 100.
turtle.title(title)
turtle.speed(args.speed)
turtle.setworldcoordinates(0, 655.36, 655.36, 0)
turtle.pen(shown=False, pendown=False, pensize=10)
for i,pos in enumerate(path):
if pen_up[i]:
turtle.penup()
else:
turtle.setpos(pos)
turtle.pendown()
turtle.dot(size=10)
_input('Press enter to continue')
turtle.clear()
turtle.bye()
示例9: draw_rectangle
def draw_rectangle():
Fline = line.split()
if Fline[1] == 'not_int':
print(Fline)
print("I'm sorry, I cannot understand that integer")
return
if len(Fline) < 4:
print(Fline)
print("I'm sorry, I do not understand that value")
return
x = int(Fline[1])
y = int(Fline[2])
width = int(Fline[3])
height = int(Fline[4])
turtle.penup()
turtle.setpos(x, y)
turtle.setheading(0)
turtle.pendown()
turtle.begin_fill()
turtle.forward(width)
turtle.setheading(-90)
turtle.forward(height)
turtle.setheading(180)
turtle.forward(width)
turtle.setheading(90)
turtle.forward(height)
turtle.end_fill()
示例10: draw_vertrect
def draw_vertrect(length,width,color):
turtle.pendown()
turtle.color(color)
turtle.begin_fill()
#uses color to determine length of cross
if(color=="blue" or color == "red" or color == "light coral" or color=="yellow"):
length*=.4375
elif(color == "snow"or color=="navy" ):
length*=.42857
else:
length*=.375
print("the length of the first " , length, " and the width is ", width)
#loops to draw vertical rectangle
for x in range(5):
if(x%5==0):
#draws first half of left vertical line
turtle.forward((length))
print("drawing length")
#draws from top of vertical to bottom of flag
elif(x%2==0):
turtle.forward(length*2+width)
print("drawing long side")
#draws small side of vertical rectangle
elif(x!=5):
turtle.forward(width)
turtle.right(90)
turtle.end_fill()
示例11: drawCircleAt
def drawCircleAt(turtleX, turtleY, circleSize):
turtle.penup()
turtle.goto(turtleX,turtleY)
turtle.pendown()
turtle.begin_fill()
turtle.circle(circleSize)
turtle.end_fill()
示例12: draw_grid
def draw_grid(ll,ur):
size = ur - ll
for gridsize in [1, 2, 5, 10, 20, 50, 100 ,200, 500]:
lines = (ur-ll)/gridsize
# print('gridsize', gridsize, '->', int(lines)+1, 'lines')
if lines <= 11: break
turtle.color('gray')
turtle.width(1)
x = ll
while x <= ur:
if int(x/gridsize)*gridsize == x:
turtle.penup()
turtle.goto(x, ll-.25*gridsize)
turtle.write(str(x),align="center",font=("Arial",12,"normal"))
turtle.goto(x,ll)
turtle.pendown()
turtle.goto(x,ur)
# print(x,ll,'to',x,ur)
x += 1
y = ll
while y <= ur:
# horizontal grid lines:
if int(y/gridsize)*gridsize == y:
turtle.penup()
turtle.goto(ll-.1*gridsize, y - .06*gridsize)
turtle.write(str(y),align="right",font=("Arial",12,"normal"))
turtle.goto(ll,y)
turtle.pendown()
turtle.goto(ur,y)
# print(ll,y,'to',ur,y)
y += 1
示例13: draw_rectangle
def draw_rectangle(x,y,width,height):
"""
Draws a rectangle with the upper left hand corner starting at point (x,y).
The said rectangle has the dimensions width x height.
:param x:
:param y:
:param width:
:param height:
:return: None
"""
turtle.penup()
turtle.setx(x)
turtle.sety(y)
turtle.pendown()
turtle.setheading(0) # Set heading in x+ direction
turtle.begin_fill()
turtle.begin_poly()
turtle.fd(width)
turtle.right(90)
turtle.fd(height)
turtle.right(90)
turtle.fd(width)
turtle.right(90)
turtle.fd(height)
turtle.end_poly()
turtle.end_fill()
return None
示例14: drawFins
def drawFins(size):
turtle.fillcolor("red")
turtle.setheading(90)
turtle.begin_fill()
turtle.forward(0.2*size)
turtle.left(120)
turtle.forward(0.6*size)
turtle.right(120)
turtle.forward(0.3*size)
turtle.right(40)
turtle.forward(0.8*size)
turtle.end_fill()
turtle.setheading(0)
turtle.begin_fill()
turtle.penup()
turtle.forward(size)
turtle.pendown()
turtle.begin_fill()
turtle.right(50)
turtle.forward(0.8*size)
turtle.right(40)
turtle.forward(0.3*size)
turtle.right(120)
turtle.forward(0.6*size)
turtle.end_fill()
示例15: circunferencia
def circunferencia(simbolos,identificador,linea):
p1= obtener_punto(2,identificador,simbolos)
radio = obtener_radio(identificador,simbolos)
x1 = obtener_x(p1,simbolos)
y1 = obtener_y(p1,simbolos)
escalar = obtener_escalar(identificador, simbolos,linea)
relleno = obtener_color(obtener_relleno(identificador,simbolos,linea))
borde = obtener_color(obtener_borde(identificador,simbolos,linea))
turtle.color(borde)
if escalar == 0:
escalar=1
tx = obtener_tx(identificador, simbolos,linea)
ty = obtener_ty(identificador, simbolos,linea)
turtle.pensize(8)
turtle.penup()
#Trasladar circunferencia
x1 = x1 + tx
y1 = y1 + ty
#turtle.setposition(x1, y1-(radio*44))
#turtle.pendown()
#turtle.circle(radio*44)
#Escalar circunferencia
turtle.penup()
#turtle.setposition(x1, y1-(radio*44*escalar))
turtle.setposition(x1*44, (y1*44)-(radio*44*escalar))
turtle.pendown()
turtle.fillcolor(relleno)
turtle.begin_fill()
turtle.circle(radio*44*escalar)
turtle.end_fill()