猫史档案馆


【Python作品分享】NIU

用户:闻香识人gaq6闻香识人gaq6查看:0 回复:0 评论:0 创建时间:2020-10-23T21:16:05


【作品展示】

center_image

 

【作品介绍】

走来走去

 

【作品源代码】

import turtle
import easygui
import random
import time

__Pen = turtle.Pen()


turtle.bgcolor("#000000")
q = turtle.numinput('你要从x轴的哪里开始', '请输入数字')
w = turtle.numinput('你要从y轴的哪里开始', '请输入数字')
colors = ['red', 'yellow', 'blue', 'green', 'orange', 'purple', 'white', 'gray']
__Pen.penup()
__Pen.goto(q, w)
__Pen.pendown()
__Pen.right(40)
for __count in range(40):
    for __count in range(40):
        if (easygui.ynbox('走不走', 'Codemao', ('1', '2')) == 1):
            e = int(turtle.numinput('你想循环几次?', '请输入数字'))
            b = int(turtle.numinput('幅度要有多大?', '请输入数字'))
            for __count in range(e):
                __Pen.pencolor(random.choice(colors))
                __Pen.circle(b, 80)
                __Pen.circle((b - b * 2), 80)
        else:
            if (easygui.ynbox('是否需要拐弯?', 'Codemao', ('1', '2')) == 1):
                r = turtle.numinput('旋转几度,', '请输入数字')
                if (easygui.ynbox('左转扣1,右转扣2,', 'Codemao', ('1', '2')) == 1):
                    __Pen.left(r)
                else:
                    __Pen.right(r)
            else:
                if (easygui.ynbox('要不要来点特技?', 'Codemao', ('1', '2')) == 1):
                    v = int(turtle.numinput('循环', '请输入数字'))
                    b = int(turtle.numinput('多少', '请输入数字'))
                    __Pen.right(random.randint(1, 30))
                    for __count in range(v):
                        for __count in range(b):
                            __Pen.pencolor(random.choice(colors))
                            __Pen.circle(50, 80)
                            __Pen.circle((50 - 50 * 2), 80)
                        b -= 3
                        __Pen.left(90)
                else:
                    if (easygui.ynbox('彩色弹球', 'Codemao', ('1', '2')) == 1):
                        c = int(turtle.numinput('你要转动多少次', '请输入数字'))
                        qq = int(turtle.numinput('其实长度', '请输入数字'))
                        w = 4
                        qqq = int(turtle.numinput('你要多出', '请输入数字'))
                        if (qqq >= 10):
                            easygui.msgbox('这可能是个霸道的社')
                        for __count in range(c):
                            for __count in range(qq):
                                __Pen.speed(40)
                                __Pen.pensize(qqq)
                                __Pen.circle(20, 25)
                                __Pen.circle((20 - 20 * 2), 25)
                                __Pen.pencolor(random.choice(colors))
                            __Pen.right(160)
                            qq += 1
                    else:
                        if (easygui.ynbox('看来这都满足不了你呀,又不能用直线画图,', 'Codemao', ('1', '2')) == 1):
                            for __count in range(20):
                                q = int(input(''))
                                if (q == 1):
                                    pass

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页