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

Python turtle.pendown函数代码示例

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

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



在下文中一共展示了pendown函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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")
开发者ID:rckc,项目名称:CoderDojoUWA2016,代码行数:7,代码来源:Peter+-+Space+Rocket.py


示例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()
开发者ID:roni16-meet,项目名称:MEET-YL1,代码行数:7,代码来源:paint.py


示例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()
开发者ID:Papapashu,项目名称:main,代码行数:26,代码来源:python_three.py


示例4: entrance

def entrance(pointOne):
    turtle.goto(pointOne[0], pointOne[1] + 36)
    turtle.setheading(270)
    turtle.pendown()
    turtle.forward(15)
    turtle.penup()
    drawArrows()
开发者ID:JonSchwarz23,项目名称:Automaton,代码行数:7,代码来源:NoSaveAutomaton.py


示例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
开发者ID:JakenHerman,项目名称:python-homework,代码行数:27,代码来源:GraphicsAndPatternLibrary.py


示例6: at

def at(x, y):
    turtle.penup()
    turtle.home()
    turtle.forward(x)
    turtle.left(90)
    turtle.forward(y)
    turtle.pendown()
开发者ID:michaelmp,项目名称:python-lab,代码行数:7,代码来源:lab2.py


示例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()
开发者ID:mukasama,项目名称:portfolio,代码行数:27,代码来源:Project++04.py


示例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()
开发者ID:perimosocordiae,项目名称:pyhrm,代码行数:29,代码来源:extract_images.py


示例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()
开发者ID:thatsmysky,项目名称:Python-Program-Four,代码行数:27,代码来源:PROGRAM+4+CODE.py


示例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()
开发者ID:joshbenner851,项目名称:CSE231,代码行数:27,代码来源:proj06.py


示例11: drawCircleAt

def drawCircleAt(turtleX, turtleY, circleSize):
    turtle.penup()
    turtle.goto(turtleX,turtleY)
    turtle.pendown()
    turtle.begin_fill()
    turtle.circle(circleSize)
    turtle.end_fill()
开发者ID:cparker,项目名称:pythonclub,代码行数:7,代码来源:one.py


示例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
开发者ID:ipmichael,项目名称:cmsc421,代码行数:31,代码来源:tdraw.py


示例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
开发者ID:brendanoconnor913,项目名称:pythonwork,代码行数:27,代码来源:Assignment4-turtlegraphics.py


示例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()
开发者ID:rckc,项目名称:CoderDojoUWA2016,代码行数:29,代码来源:Peter+-+Space+Rocket.py


示例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()
开发者ID:joenco,项目名称:compiladorg,代码行数:35,代码来源:figuras.py


示例16: tegnGitter

    def tegnGitter(i0,i1,j0,j1):
        """Gitteret har søjler fra i0 til og med i1 og rækker fra
j0 til og med j1.  Først blankstilles lærredet"""
        xmin,ymin = toXY(i0,j0)
        xlen,ylen = (i1-i0+2)*cs,(j1-j0+2)*cs
        tt.clear()
        tt.penup()
        tt.color(kodefarve[4])
        # vandrette linjer
        x,y = xmin-cs/2,ymin
        tt.setheading(0) # øst
        for j in range(j0,j1+2):
            tt.goto(x,y)
            tt.pendown()
            tt.forward(xlen)
            tt.penup()
            y += cs
        # lodrette linjer
        x,y = xmin,ymin-cs/2
        tt.setheading(90) # nord
        for i in range(i0,i1+2):
            tt.goto(x,y)
            tt.pendown()
            tt.forward(ylen)
            tt.penup()
            x += cs
开发者ID:androidYibo,项目名称:documents,代码行数:26,代码来源:kursusuge5modul.py


示例17: draw

	def draw(self):
		
		turtle.penup()
		turtle.goto(self.point_st)
		turtle.pendown()
		turtle.color(self.border_c, self.fill_c)	
		self._draw()
开发者ID:mprihodko,项目名称:python,代码行数:7,代码来源:test3.py


示例18: drawPoint

def drawPoint(x, y): 
    turtle.penup() # Pull the pen up
    turtle.goto(x, y)
    turtle.pendown() # Pull the pen down
    turtle.begin_fill() # Begin to fill color in a shape
    turtle.circle(3) 
    turtle.end_fill() # Fill the shape
开发者ID:EthanSeaver,项目名称:Python-Projects,代码行数:7,代码来源:UsefulTurtleFunctions.py


示例19: drawS

def drawS(turtle, height, width):
    """
    draw the letter S using turtle, with some height and width
    """
    # Pick pen up and move a little to the right
    turtle.penup()
    turtle.setheading(0)
    turtle.forward((1.0/6.0)*width)
    # Put pen down and draw bottom of S
    turtle.pendown()
    turtle.forward((2.0/3.0)*width)
    # Draw first curve
    turtle.left((180.0/math.pi)*math.atan((3.0/2.0)*height/width))
    turtle.forward(math.sqrt(((1.0/6.0)*width)**2+((1.0/4.0)*height)**2))
    turtle.left(180.0-(360.0/math.pi)*math.atan((3.0/2.0)*height/width))
    turtle.forward(math.sqrt(((1.0/6.0)*width)**2+((1.0/4.0)*height)**2))
    turtle.left((180.0/math.pi)*math.atan((3.0/2.0)*height/width))
    # Draw middle of S
    turtle.forward((2.0/3.0)*width)
    # Draw second curve
    turtle.right((180.0/math.pi)*math.atan((3.0/2.0)*height/width))
    turtle.forward(math.sqrt(((1.0/6.0)*width)**2+((1.0/4.0)*height)**2))
    turtle.right(180.0-(360.0/math.pi)*math.atan((3.0/2.0)*height/width))
    turtle.forward(math.sqrt(((1.0/6.0)*width)**2+((1.0/4.0)*height)**2))
    turtle.right((180.0/math.pi)*math.atan((3.0/2.0)*height/width))
    # Draw top of S, pick up pen, and move a little to the right
    turtle.forward((2.0/3.0)*width)
    turtle.penup()
    turtle.forward((1.0/6.0)*width)
开发者ID:RJDSTUART,项目名称:CS20-S16-lab03,代码行数:29,代码来源:lab03.py


示例20: draw_rectangle

def draw_rectangle(length_float, width_float, color_str):
    """
    Asks for the length, width, and color of the rectangle and draws it
    using turtle
    
    Recieve:    The length, width and color of the triangle
    Return:     Nothing
    Algorithm:
        Use a for loop and draw a rectangle by going forward the specified
        length and making a 90 degree turn to the right and then going
        forward the width and turning 90 degrees to the right
        Then do the loop again
    """
    
    turtle.fillcolor(color_str)    
    turtle.pendown()
    turtle.begin_fill()
    
    for i in range(2):
        turtle.forward(length_float)
        turtle.right(90)
        turtle.forward(width_float)
        turtle.right(90)
        
    turtle.end_fill()
    turtle.penup()
开发者ID:vishaladu,项目名称:pythonprojects,代码行数:26,代码来源:proj06lib.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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