Beispiele und Musterlösungen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 months ago
12345678910111213141516171819202122232425262728293031
  1. from turtle import Turtle
  2. def draw_segment(turtle, degree, length):
  3. turtle.pendown()
  4. turtle.begin_fill()
  5. turtle.circle(length, degree)
  6. turtle.left(90)
  7. turtle.forward(length)
  8. turtle.right(degree)
  9. turtle.backward(length)
  10. turtle.end_fill()
  11. turtle.penup()
  12. turtle.forward(length)
  13. turtle.left(degree)
  14. turtle.backward(length)
  15. turtle.right(90)
  16. Turtle.draw_segment = draw_segment
  17. sophia = Turtle()
  18. sophia.pencolor('red')
  19. sophia.fillcolor('red')
  20. sophia.draw_segment(240, 100)
  21. sophia.pencolor('blue')
  22. sophia.fillcolor('blue')
  23. sophia.draw_segment(90, 100)
  24. sophia.pencolor('green')
  25. sophia.fillcolor('green')
  26. sophia.draw_segment(30, 100)
  27. sophia.hideturtle()
  28. sophia.screen.mainloop()