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

Python turtle.fd函数代码示例

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

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



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

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


示例2: takieCos

def takieCos(n):
    rotateUpwards = [0, 3, 4]
    rot = -90

    for j in range(0,2):
        # for j in range(0,2):
        turtle.fd(1.5*n)
        turtle.rt(-90)
        turtle.fd(n)
        turtle.rt(90)
        turtle.fd(n)
        turtle.rt(90)
        turtle.fd(n)
        turtle.rt(-90)
        turtle.fd(1.5*n)
        if (j in rotateUpwards):
            turtle.rt(-90)
        else:
            turtle.rt(90)
    turtle.rt((-1)*rot)
    # turtle.rt(180)


    takieCos(n)
    raw_input()
开发者ID:Cube189,项目名称:WdPPyth,代码行数:25,代码来源:zad1beta.py


示例3: drawSide

def drawSide(l):
    """
        Draw one side of the hexagon.
        l is side length
    """
    turtle.fd(l)
    turtle.rt(60)
开发者ID:ArthuruhtrA,项目名称:Fall-2014,代码行数:7,代码来源:hexes-full.py


示例4: koch

def koch(size, n):
    if n == 0:
        turtle.fd(size)
    else:
        for angle in [0, 60, -120, 60]:
            turtle.left(angle)
            koch(size/3, n-1)
开发者ID:BrandonSherlocking,项目名称:python_document,代码行数:7,代码来源:科赫曲线绘制.py


示例5: ustNaStart

def ustNaStart(r):
    turtle.lt(90)
    turtle.pu()
    turtle.rt(90)
    turtle.fd(r)
    turtle.lt(90)
    turtle.pd()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_2.py


示例6: jeden

def jeden():
    turtle.fd(50)
    turtle.fillcolor(randint(0,255),randint(0,255),randint(0,255))
    turtle.begin_fill()
    kwadrat(50)
    turtle.end_fill()
    turtle.bk(50)
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_3.py


示例7: 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()
开发者ID:RichardBarrell,项目名称:snippets,代码行数:25,代码来源:draw_l.py


示例8: ustDoKwadratu

def ustDoKwadratu(dlBokKw):
    turtle.pu()
    turtle.fd(dlBokKw * 2)
    turtle.lt(90)
    turtle.fd(dlBokKw * 2)
    turtle.lt(90)
    turtle.pd()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_4.py


示例9: skidMark

def skidMark(lineLength):
    turtle.pensize(2)
    turtle.pencolor(0, 0, 0)
    for x in range(lineLength):
        turtle.pencolor(x,x,x)
        turtle.fd(x)
        turtle.right(90)
开发者ID:KrbAlmryde,项目名称:Homework,代码行数:7,代码来源:Lab3.py


示例10: ustDoElki

def ustDoElki(dlBokKw, bokKr):
    turtle.pu()
    turtle.fd(bokKr - dlBokKw)
    turtle.lt(90)
    turtle.fd(dlBokKw)
    turtle.lt(90)
    turtle.pd()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_4.py


示例11: ustDo2Elki

def ustDo2Elki(dlBokKw, bokKr, bokDl):
    turtle.pu()
    turtle.fd(bokKr - dlBokKw *2)
    turtle.rt(90)
    turtle.fd(bokDl - dlBokKw*2)
    turtle.rt(90)
    turtle.pd()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_4.py


示例12: ustNaStart

def ustNaStart(a):
    turtle.pu()
    turtle.bk(a)
    turtle.lt(90)
    turtle.fd(a / 2)
    turtle.rt(90)
    turtle.pd()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_1.py


示例13: kwadrat

def kwadrat(kolor): #kwadrat
    t.fillcolor(kolor)
    t.begin_fill()
    for i in range(4):
        t.fd(B)
        t.rt(90)
    t.end_fill()
开发者ID:chinski99,项目名称:minilogia,代码行数:7,代码来源:owoc.py


示例14: drawStar

def drawStar(N, R):
    turtle.reset()
    a = 360/N
    for i in range(N):
        turtle.fd(R)
        turtle.bk(R)
        turtle.left(a)
开发者ID:circulocity,项目名称:tp10,代码行数:7,代码来源:sootsprite.py


示例15: okoP

def okoP(a):
    turtle.begin_fill()
    wielokat(6, a *4, 4)
    turtle.end_fill()
    turtle.rt(180)
    turtle.fd(a * 4)
    turtle.lt(360 / 6)
    turtle.fd(a * 4)
    turtle.lt(360 / 6)
    turtle.fd(a * 4)
    turtle.colormode(255)
    turtle.fillcolor(255, 255, 255)
    turtle.rt(180)
    turtle.fd(a)
    turtle.rt(120)
    turtle.begin_fill()
    wielokat(6, 2 * a, 4)
    turtle.end_fill()
    turtle.rt(60)
    turtle.fd(a / 2)
    turtle.rt(120)
    turtle.fillcolor(0, 0, 0)
    turtle.begin_fill()
    wielokat(6, a, 4)
    turtle.end_fill()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:25,代码来源:Zadanie_1.py


示例16: tSquare

def tSquare(size, level):
    """ The T-Square fractal.
    http://en.wikipedia.org/wiki/T-Square_%28fractal%29
    """

    if level < 1:
        drawSquare(size, True)
    else:
        drawSquare(size, True)
        bk(size / 4.0)
        left(90)
        fd(size / 4.0)
        right(90)
        tSquare(size / 2.0, level - 1)
        up()
        fd(size)
        down()
        tSquare(size / 2.0, level - 1)
        right(90)
        fd(size)
        left(90)
        tSquare(size / 2.0, level - 1)
        bk(size)
        tSquare(size / 2.0, level - 1)
        left(90)
        up()
        fd(size * 3 / 4.0)
        down()
        right(90)
        fd(size / 4.0)
开发者ID:peterasujan,项目名称:fractals,代码行数:30,代码来源:fractals.py


示例17: cuadrado

 def cuadrado(lado, color):
     turtle.color(color)
     turtle.begin_fill()
     for _ in xrange(4):
         turtle.fd(lado)
         turtle.right(90)
     turtle.end_fill()
开发者ID:lvidarte,项目名称:logo,代码行数:7,代码来源:colores.py


示例18: turmandel

def turmandel(step, zoom, xres, yres, xthresh, ythresh):
  turtle.setheading(0)
  for y in range(yres):
    turtle.pu()
    turtle.setpos(0, y)
    turtle.pd()
    for x in range(xres):
      x = float(x)
      y = float(y)
      u = float(x)/float((xres/zoom))-xthresh
      v = float(y)/float((yres/zoom))-ythresh
      x0 = float(u)
      y0 = float(v)
      a = 0.0
      b = 0.0
      i = step
      while ((i>0) and (a+b<=4.0)):
        a = float(x0*x0)
        b = float(y0*y0)
        y0 = float(2.0*x0*y0+v)
        x0 = float(a-b+u)
        i = i - 1
      color = i % 255
      turtle.pencolor((color, color, color))
      if i < 1:
        turtle.pencolor((0,0,0))
      turtle.fd(1)
开发者ID:lgaff,项目名称:snippets,代码行数:27,代码来源:turtlestuff.py


示例19: test_zigzag

 def test_zigzag(self):
     """
     Test that a AsyncTurtle ends up in the correct position
     after several concurrent commands in sequence, and draws
     a zigzag line on the canvas.
     """
     turtle = AsyncTurtle(loop=self.loop)
     tasks = [
         asyncio.ensure_future(turtle.fd(10), loop=self.loop),
         asyncio.ensure_future(turtle.lt(90), loop=self.loop),
         asyncio.ensure_future(turtle.fd(10), loop=self.loop),
         asyncio.ensure_future(turtle.rt(90), loop=self.loop),
         asyncio.ensure_future(turtle.fd(10), loop=self.loop)
     ]
     self.loop.run_until_complete(asyncio.wait(tasks, loop=self.loop))
     self.loop.close()
     self.assertEqual(turtle.pos()[0], 20)
     self.assertEqual(turtle.pos()[1], 10)
     expected_coords = [
         0.0, 0.0,
         10.0, 0.0,
         10.0, -10.0,
         20.0, -10.0
     ]
     # Assume the last item id on the canvas is the line
     # drawn by the turtle. Check if this assumption is valid.
     line_id = max(turtle.screen.cv.find_all())
     self.assertEqual(turtle.screen.cv.coords(line_id), expected_coords)
开发者ID:appeltel,项目名称:aioturtle,代码行数:28,代码来源:test_aioturtle.py


示例20: ustNaStart

def ustNaStart(dlBokKw, ile):
    turtle.pu()
    turtle.bk(dlBokKw * ile / 2 +5)
    turtle.lt(90)
    turtle.fd(dlBokKw * (ile - 2) / 2 - 5)
    turtle.rt(90)
    turtle.pd()
开发者ID:ujanlabs,项目名称:miniLogia_Py,代码行数:7,代码来源:Zadanie_3.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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