MCPcopy Index your code
hub / github.com/python/cpython / ColorTurtle

Class ColorTurtle

Lib/turtledemo/colormixer.py:4–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2from turtle import Screen, Turtle, mainloop
3
4class 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
33def setbgcolor():
34 screen.bgcolor(red.ycor(), green.ycor(), blue.ycor())

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…