Server IP : 66.29.132.122 / Your IP : 18.117.158.203 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/usr/lib64/python2.7/Demo/turtle/ |
Upload File : |
#! /usr/bin/python2.7 """ 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()