美文网首页
Turtle海龟画图

Turtle海龟画图

作者: 千年积木 | 来源:发表于2023-03-09 15:20 被阅读0次
    #颜色单词:
    #红色:red    白色:white   黄色:yellow   蓝色:blue
    #黑色:black  青色:cyan    洋红:magenta  金色:gold
    #粉色:pink   紫色:purple  番茄色:tomato 棕色:brown
    #橙色:orange 绿色:green   海贝色:seashell
    
    import turtle as t
    t.setup(500,600)#设置画布大小
    #画笔形状有:turtle,arrow,circle,triangle,classic
    t.shape("turtle")   #设置画笔形状
    t.begin_fill()
    t.color("red","black")#画笔颜色/填充颜色
    t.speed(0)#1-10变快,0最快
    t.fd(100)
    t.circle(100,360,100) #半径,角度,边数
    t.end_fill()
    
    t.up()
    t.goto(100,-200)
    t.seth(120)
    t.dot(100,"red") #画点(大小,颜色)
    t.dot(80,"white")
    t.dot(60,"red")
    t.dot(40,"blue")
    t.pos()#获取画笔x,y坐标
    
    print("x=",t.pos()[0])
    print("y=",t.pos()[1])
    
    t.reset()#重置画布画笔
    t.done()#完成绘制
    t.hideturtle()      #隐藏画笔
    t.showturtle()      #显示画笔
    
    
    
    
    

    相关文章

      网友评论

          本文标题:Turtle海龟画图

          本文链接:https://www.haomeiwen.com/subject/cpnaldtx.html