Я хотел бы заполнить свою форму, которую я создал с помощью модуля черепахи в Python. Это мой код до сих пор: < /p>
def koch_segment(trtl, length, currentdepth):
trtl.fillcolor("green")
trtl.shape("turtle")
if currentdepth == depth:
trtl.forward(length)
else:
currentlength = length/3.0
trtl.pencolor("Blue")
koch_segment(trtl, currentlength,currentdepth + 1)
trtl.left(60)
trtl.pencolor("Red")
koch_segment(trtl, currentlength, currentdepth + 1)
trtl.right(120)
trtl.pencolor("Green")
koch_segment(trtl, currentlength, currentdepth + 1)
trtl.left(60)
trtl.pencolor("Orange")
koch_segment(trtl, currentlength, currentdepth + 1)
wn = turtle.Screen()
wx = wn.window_width() * .5
wh = wn.window_height() * .5
base_lgth = 2.0 / math.sqrt(3.0) * wh # is the base length dependant on the screen size
myturtle = turtle.Turtle()
myturtle.speed(0.5 * (depth + 9)) # value between 1 and 10 (fast)
myturtle.penup()
myturtle.setposition((-wx / 2, -wh / 2)) # start in the lower left quadrant middle point
myturtle.pendown()
myturtle.left(60)
return myturtle, base_lgth
Подробнее здесь: https://stackoverflow.com/questions/718 ... ith-turtle
Как я могу заполнить свою форму в питоне с черепахой? [закрыто] ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Поверните игру с черепахой Python в многопользовательскую игру LAN LAN [закрыто]
Anonymous » » в форуме Python - 0 Ответы
- 42 Просмотры
-
Последнее сообщение Anonymous
-