【Python】turtle库的小应用

心血来潮,哈哈哈,画的不好,请多见谅 

大家如果想要尝试turtle库,可以借鉴:

https://www.cnblogs.com/nowgood/p/turtle.html

导入库,我的pycharm里可以直接使用,哈哈哈,不行就pip吧

import turtle

if __name__ == '__main__':

    turtle.hideturtle()
    turtle.screensize(800,600,'pink');
    turtle.pensize(30);
    turtle.pencolor('red');
    turtle.speed(10);
    turtle.penup();
    turtle.goto(-100,0);
    turtle.pendown();
    turtle.right(90);
    turtle.circle(80,180);
    turtle.penup();
    turtle.goto(-80, 160);
    turtle.pendown();
    turtle.circle(40, 180);
    turtle.penup();
    turtle.goto(100, 160);
    turtle.pendown();
    turtle.right(180);
    turtle.circle(40, 180);
    turtle.penup();
    turtle.goto(-90, 120);
    turtle.pendown();
    turtle.forward(1);
    turtle.penup();
    turtle.goto(60, 120);
    turtle.pendown();
    turtle.forward(1);
    turtle.mainloop()

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 技术工厂 设计师:CSDN官方博客 返回首页