本文整理汇总了Python中turtle.fd函数的典型用法代码示例。如果您正苦于以下问题:Python fd函数的具体用法?Python fd怎么用?Python fd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
示例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()
示例3: drawSide
def drawSide(l):
"""
Draw one side of the hexagon.
l is side length
"""
turtle.fd(l)
turtle.rt(60)
示例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)
示例5: ustNaStart
def ustNaStart(r):
turtle.lt(90)
turtle.pu()
turtle.rt(90)
turtle.fd(r)
turtle.lt(90)
turtle.pd()
示例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)
示例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()
示例8: ustDoKwadratu
def ustDoKwadratu(dlBokKw):
turtle.pu()
turtle.fd(dlBokKw * 2)
turtle.lt(90)
turtle.fd(dlBokKw * 2)
turtle.lt(90)
turtle.pd()
示例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)
示例10: ustDoElki
def ustDoElki(dlBokKw, bokKr):
turtle.pu()
turtle.fd(bokKr - dlBokKw)
turtle.lt(90)
turtle.fd(dlBokKw)
turtle.lt(90)
turtle.pd()
示例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()
示例12: ustNaStart
def ustNaStart(a):
turtle.pu()
turtle.bk(a)
turtle.lt(90)
turtle.fd(a / 2)
turtle.rt(90)
turtle.pd()
示例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()
示例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)
示例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()