用python画柯南代码
时间: 2023-07-23 12:11:53 浏览: 153
以下是用Python绘制柯南的代码:
```python
import turtle
# 设置画布大小
turtle.setup(800, 600)
# 移动画笔到指定位置,开始绘制
turtle.penup()
turtle.goto(0, -200)
turtle.pendown()
# 绘制头部
turtle.circle(200)
# 绘制眼睛
turtle.penup()
turtle.goto(-80, 100)
turtle.pendown()
turtle.begin_fill()
turtle.circle(40)
turtle.end_fill()
turtle.penup()
turtle.goto(80, 100)
turtle.pendown()
turtle.begin_fill()
turtle.circle(40)
turtle.end_fill()
# 绘制鼻子
turtle.penup()
turtle.goto(0, 20)
turtle.pendown()
turtle.begin_fill()
turtle.circle(30)
turtle.end_fill()
# 绘制嘴巴
turtle.penup()
turtle.goto(-80, -50)
turtle.pendown()
turtle.goto(80, -50)
# 绘制身体
turtle.penup()
turtle.goto(0, -200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(200)
turtle.end_fill()
# 绘制手臂
turtle.penup()
turtle.goto(-200, -200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
turtle.penup()
turtle.goto(200, -200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(50)
turtle.end_fill()
# 绘制脚
turtle.penup()
turtle.goto(-80, -350)
turtle.pendown()
turtle.begin_fill()
turtle.circle(80)
turtle.end_fill()
turtle.penup()
turtle.goto(80, -350)
turtle.pendown()
turtle.begin_fill()
turtle.circle(80)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 等待用户关闭画布
turtle.done()
```
运行以上代码,即可在窗口中看到绘制的柯南图像。
相关推荐
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)