python用tkinter画有四肢的雪人
时间: 2023-12-03 13:39:45 浏览: 84
python绘制雪景图
以下是使用Python的Tkinter库画有四肢的雪人的代码示例:
```python
from tkinter import *
# 创建画布
root = Tk()
canvas = Canvas(root, width=400, height=400)
canvas.pack()
# 画雪人的身体
canvas.create_oval(150, 150, 250, 250, fill='white', outline='black')
canvas.create_oval(125, 100, 275, 150, fill='white', outline='black')
canvas.create_oval(175, 250, 225, 300, fill='white', outline='black')
# 画雪人的四肢
canvas.create_line(200, 150, 200, 100, width=5)
canvas.create_line(200, 250, 200, 300, width=5)
canvas.create_line(150, 200, 100, 200, width=5)
canvas.create_line(250, 200, 300, 200, width=5)
# 画雪人的眼睛和嘴巴
canvas.create_oval(185, 125, 195, 135, fill='black')
canvas.create_oval(205, 125, 215, 135, fill='black')
canvas.create_arc(185, 150, 215, 175, start=190, extent=160, style='arc', width=2)
# 运行窗口
root.mainloop()
```
阅读全文