猫史档案馆


【Python作品分享】小海龟编辑器1.0【作品秀】

用户:穿山甲汤穿山甲汤查看:0 回复:0 评论:0 创建时间:2021-12-18T20:59:14


【作品展示】

center_image

 

【作品介绍】

新作品!!!!

小海龟编辑器1.0

 

【作品源代码】

import turtle


w = turtle.Pen()
t = turtle.Pen()
s = turtle.Screen()
turtle.colormode(255)
print('欢迎来到小海龟画画器')

def mo():

    print('1是特定图形')
    print('2是颜色寻择(本作品使用rgb颜色,可以上网查)')
    print('3是粗细度')
    print('4是在某个地方写字')
    print('10是退出')
    xu = int(input('请选择模式'))
    if (xu == 2):
        r = int(input('红色数'))
        g = int(input('绿色数'))
        b = int(input('蓝色数'))
        t.pencolor(r, g, b)
    elif (xu == 3):
        xi = int(input('粗细度'))
        t.pensize(xi)
    elif (xu == 4):
        zi = input('写啥')
        t.write(zi)
    else:
        print('退出')

def xian(x, y):

    t.goto(x, y)

def xian_t(x, y):

    t.penup()
    t.goto(x, y)
    t.pendown()

def c_q():

    t.clear()

def c_w():

    t.undo()

s.onclick(xian,btn=1)
s.onclick(xian_t,btn=3)
s.listen()
s.onkey(mo,"q")
s.onkey(c_q, "n")
s.onkey(c_w, "m")
turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页