Python用turtle画沈阳药科大学校徽
时间: 2023-08-21 18:38:02 浏览: 101
好的,下面是使用Python中的turtle库画沈阳药科大学校徽的代码:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor('white')
# 画外圆
turtle.penup()
turtle.goto(0, -200)
turtle.pendown()
turtle.circle(200)
# 画内圆
turtle.penup()
turtle.goto(0, -100)
turtle.pendown()
turtle.circle(100)
# 画左上方的小方块
turtle.penup()
turtle.goto(-150, 150)
turtle.pendown()
turtle.begin_fill()
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.end_fill()
# 画右上方的小方块
turtle.penup()
turtle.goto(50, 150)
turtle.pendown()
turtle.begin_fill()
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.end_fill()
# 画左下方的小方块
turtle.penup()
turtle.goto(-150, -250)
turtle.pendown()
turtle.begin_fill()
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.end_fill()
# 画右下方的小方块
turtle.penup()
turtle.goto(50, -250)
turtle.pendown()
turtle.begin_fill()
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.end_fill()
# 画左上方的药瓶
turtle.penup()
turtle.goto(-100, 200)
turtle.pendown()
turtle.begin_fill()
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.end_fill()
# 画右上方的药瓶
turtle.penup()
turtle.goto(50, 200)
turtle.pendown()
turtle.begin_fill()
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.end_fill()
# 画左下方的药瓶
turtle.penup()
turtle.goto(-100, -300)
turtle.pendown()
turtle.begin_fill()
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.end_fill()
# 画右下方的药瓶
turtle.penup()
turtle.goto(50, -300)
turtle.pendown()
turtle.begin_fill()
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(150)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 显示画板
turtle.done()
```
运行以上代码,即可得到沈阳药科大学校徽的图形。