PHP 8.2.30
Preview: paint.py Size: 1.26 KB
//lib64/python3.8/turtledemo/paint.py

#! /usr/bin/python3.8
"""       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 toggles between 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()

Directory Contents

Dirs: 1 × Files: 22

Name Size Perms Modified Actions
- drwxr-xr-x 2024-03-21 10:19:13
Edit Download
4.15 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
951 B lrw-r--r-- 2023-06-06 13:32:21
Edit Download
3.13 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
1.31 KB lrw-r--r-- 2023-06-06 13:32:21
Edit Download
2.90 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
3.39 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
2.38 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
2.00 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
6.36 KB lrw-r--r-- 2023-06-06 13:32:21
Edit Download
1.26 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
1.04 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
3.30 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
2.76 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
1.33 KB lrw-r--r-- 2023-06-06 13:32:21
Edit Download
1.76 KB lrw-r--r-- 2023-06-06 13:32:21
Edit Download
4.91 KB lrw-r--r-- 2023-10-17 18:12:57
Edit Download
1.37 KB lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
160 B lrw-r--r-- 2023-06-06 13:32:21
Edit Download
1.09 KB lrw-r--r-- 2023-06-06 13:32:21
Edit Download
820 B lrwxr-xr-x 2023-06-06 13:32:21
Edit Download
314 B lrw-r--r-- 2023-06-06 13:32:21
Edit Download
13.91 KB lrw-r--r-- 2023-10-17 18:12:57
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).