| 2 | from turtle import Screen, Turtle, mainloop |
| 3 | |
| 4 | class ColorTurtle(Turtle): |
| 5 | |
| 6 | def __init__(self, x, y): |
| 7 | Turtle.__init__(self) |
| 8 | self.shape("turtle") |
| 9 | self.resizemode("user") |
| 10 | self.shapesize(3,3,5) |
| 11 | self.pensize(10) |
| 12 | self._color = [0,0,0] |
| 13 | self.x = x |
| 14 | self._color[x] = y |
| 15 | self.color(self._color) |
| 16 | self.speed(0) |
| 17 | self.left(90) |
| 18 | self.pu() |
| 19 | self.goto(x,0) |
| 20 | self.pd() |
| 21 | self.sety(1) |
| 22 | self.pu() |
| 23 | self.sety(y) |
| 24 | self.pencolor("gray25") |
| 25 | self.ondrag(self.shift) |
| 26 | |
| 27 | def shift(self, x, y): |
| 28 | self.sety(max(0,min(y,1))) |
| 29 | self._color[self.x] = self.ycor() |
| 30 | self.fillcolor(self._color) |
| 31 | setbgcolor() |
| 32 | |
| 33 | def setbgcolor(): |
| 34 | screen.bgcolor(red.ycor(), green.ycor(), blue.ycor()) |
no outgoing calls
no test coverage detected
searching dependent graphs…