FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
RustPython/Lib/turtledemo/colormixer.py at main · RustPython/RustPython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
RustPython
/
RustPython
Public
Notifications
You must be signed in to change notification settings
Fork
1.5k
Star
22.3k
Code
Issues
295
Pull requests
103
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
RustPython
/
Lib
/
turtledemo
/
colormixer.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (49 loc) · 1.32 KB
Breadcrumbs
RustPython
/
Lib
/
turtledemo
/
colormixer.py
Copy path
File metadata and controls
57 lines (49 loc) · 1.32 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""turtledemo/colormixer.py"""
from
turtle
import
Screen
,
Turtle
,
mainloop
class
ColorTurtle
(
Turtle
):
def
__init__
(
self
,
x
,
y
):
Turtle
.
__init__
(
self
)
self
.
shape
(
"turtle"
)
self
.
resizemode
(
"user"
)
self
.
shapesize
(
3
,
3
,
5
)
self
.
pensize
(
10
)
self
.
_color
=
[
0
,
0
,
0
]
self
.
x
=
x
self
.
_color
[
x
]
=
y
self
.
color
(
self
.
_color
)
self
.
speed
(
0
)
self
.
left
(
90
)
self
.
pu
()
self
.
goto
(
x
,
0
)
self
.
pd
()
self
.
sety
(
1
)
self
.
pu
()
self
.
sety
(
y
)
self
.
pencolor
(
"gray25"
)
self
.
ondrag
(
self
.
shift
)
def
shift
(
self
,
x
,
y
):
self
.
sety
(
max
(
0
,
min
(
y
,
1
)))
self
.
_color
[
self
.
x
]
=
self
.
ycor
()
self
.
fillcolor
(
self
.
_color
)
setbgcolor
()
def
setbgcolor
():
screen
.
bgcolor
(
red
.
ycor
(),
green
.
ycor
(),
blue
.
ycor
())
def
main
():
global
screen
,
red
,
green
,
blue
screen
=
Screen
()
screen
.
delay
(
0
)
screen
.
setworldcoordinates
(
-
1
,
-
0.3
,
3
,
1.3
)
red
=
ColorTurtle
(
0
,
.5
)
green
=
ColorTurtle
(
1
,
.5
)
blue
=
ColorTurtle
(
2
,
.5
)
setbgcolor
()
writer
=
Turtle
()
writer
.
ht
()
writer
.
pu
()
writer
.
goto
(
1
,
1.15
)
writer
.
write
(
"DRAG!"
,
align
=
"center"
,
font
=
(
"Arial"
,
30
,(
"bold"
,
"italic"
)))
return
"EVENTLOOP"
if
__name__
==
"__main__"
:
msg
=
main
()
print
(
msg
)
mainloop
()
Back
|
FazBrowse Home
|
New Git URL