Staging
v0.5.1
v0.5.1
https://github.com/python/cpython
Revision 10df96affd0f3e21a7750db98038f8419b91db95 authored by Mariatta on 06 July 2017, 03:55:18 UTC, committed by GitHub on 06 July 2017, 03:55:18 UTC
(cherry picked from commit 76c567ee27342d76f631a35c8291b715b2a61f3e)
1 parent c48a000
Tip revision: 10df96affd0f3e21a7750db98038f8419b91db95 authored by Mariatta on 06 July 2017, 03:55:18 UTC
Fix trivial typo in json module docstring (GH-2274) (GH-2431)
Fix trivial typo in json module docstring (GH-2274) (GH-2431)
Tip revision: 10df96a
paint.py
#!/usr/bin/env python3
""" turtle-example-suite:
tdemo_paint.py
A simple event-driven paint program
- left mouse button moves turtle
- middle mouse button changes color
- right mouse button toogles betweem pen up
(no line drawn when the turtle moves) and
pen down (line is drawn). If pen up follows
at least two pen-down moves, the polygon that
includes the starting point is filled.
-------------------------------------------
Play around by clicking into the canvas
using all three mouse buttons.
-------------------------------------------
To exit press STOP button
-------------------------------------------
"""
from turtle import *
def switchupdown(x=0, y=0):
if pen()["pendown"]:
end_fill()
up()
else:
down()
begin_fill()
def changecolor(x=0, y=0):
global colors
colors = colors[1:]+colors[:1]
color(colors[0])
def main():
global colors
shape("circle")
resizemode("user")
shapesize(.5)
width(3)
colors=["red", "green", "blue", "yellow"]
color(colors[0])
switchupdown()
onscreenclick(goto,1)
onscreenclick(changecolor,2)
onscreenclick(switchupdown,3)
return "EVENTLOOP"
if __name__ == "__main__":
msg = main()
print(msg)
mainloop()
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...