本文整理汇总了Python中turtle.Turtle.bk方法的典型用法代码示例。如果您正苦于以下问题:Python Turtle.bk方法的具体用法?Python Turtle.bk怎么用?Python Turtle.bk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类turtle.Turtle
的用法示例。
在下文中一共展示了Turtle.bk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from turtle import Turtle [as 别名]
# 或者: from turtle.Turtle import bk [as 别名]
def main():
global d, SHS, SF, A
A = 42 # answer to the ultimate question ... (you know)
SHS = A / 20.
SF = 1.0
DSF = 1.0038582416
s = Screen()
s.setup(800, 600)
s.reset()
s.tracer(0)
d = Turtle(visible=False)
for i in range(6):
d.fd(500)
d.bk(500)
d.left(60)
triangles = []
for c in range(-5,6,2):
if abs(c) != 1:
triangles.append(TriTurtle(c, 1, 1))
triangles.append(TriTurtle(c, -1, 2))
for c in range(-4,5,2):
if c != 0:
triangles.append(TriTurtle(c, 2, 2))
triangles.append(TriTurtle(c, -2, 1))
triangles.append(TriTurtle(c, -4, 2))
triangles.append(TriTurtle(c, 4, 1))
for c in range(-3,4,2):
triangles.append(TriTurtle(c, 5, 2))
triangles.append(TriTurtle(c, -5, 1))
triangles.append(TriTurtle(c, -7, 2))
triangles.append(TriTurtle(c, 7, 1))
for c in range(-2,3,2):
triangles.append(TriTurtle(c, 8, 2))
triangles.append(TriTurtle(c, -8, 1))
for c in (-1, 1):
triangles.append(TriTurtle(c, 1, 1))
triangles.append(TriTurtle(c, -1, 2))
triangles.append(TriTurtle(0, 2, 2))
triangles.append(TriTurtle(0, -2, 1))
s.tracer(1)
for phi in range(1,361):
SF = SF*DSF
s.tracer(0)
for t in triangles:
t.setturn(phi)
#s.tracer(1)
s.update()
return "DONE!"