|
发表于 2021-2-15 09:01:04
|
显示全部楼层
from tkinter import *
import math as m
root=Tk()
w=Canvas(root,width=200,height=300)
w.pack()
#头部
w.create_oval(40,17,160,136,fill='deepskyblue')
w.create_oval(50,37,150,136,fill='white')
#眼睛
w.create_oval(75,27,100,50,outline='black',fill='white')
w.create_oval(100,27,125,50,outline='black',fill='white')
w.create_oval(88,34,96,43,fill='black')
w.create_oval(104,34,112,43,fill='black')
w.create_oval(92,37,94,40,fill='white')
w.create_oval(106,37,108,40,fill='white')
#鼻子
w.create_oval(92,44,108,60,fill='red')
w.create_oval(95,46,101,52,fill='white')
#嘴
w.create_line(100,60,100,105,fill='black',width=1)
w.create_arc(60,52,140,105,start=190,extent=160,style=ARC)
#胡子
w.create_line(60,57,90,65,fill='black')
w.create_line(110,67,140,55,fill='black')
w.create_line(58,72,90,72,fill='black')
w.create_line(110,74,142,70,fill='black')
w.create_line(58,84,90,80,fill='black')
w.create_line(110,82,142,82,fill='black')
#手臂
points1=[
(125,127),
(140,135),
(144,140),
(150,150),
(155,165),
(152,167),
(147,168),
]
points2=[
(75,127),
(60,135),
(56,140),
(50,150),
(45,165),
(48,167),
(53,168),
]
w.create_oval(140,159,160,179,fill='white')
w.create_oval(60,159,40,179,fill='white')
w.create_polygon(points1,fill='deepskyblue',outline='black')
w.create_polygon(points2,fill='deepskyblue',outline='black')
#脚
w.create_oval(55,200,110,225,fill='white')
w.create_oval(90,200,145,225,fill='white')
w.create_rectangle(70,200,120,221,outline='white',fill='white')
#身体
w.create_rectangle(70,130,130,205,fill='deepskyblue')
w.create_arc(55,130,88,205,start=100,extent=180,fill='deepskyblue',outline='deepskyblue')
w.create_arc(112,130,145,205,start=280,extent=180,fill='deepskyblue',outline='deepskyblue')
w.create_arc(55,130,88,205,start=150,extent=110,outline='black',style=ARC,width=1)
w.create_arc(112,130,145,205,start=280,extent=110,outline='black',style=ARC,width=1)
#腿
w.create_line(100,198,100,222)
w.create_arc(75,198,125,220,start=70,extent=40,outline='black',style=ARC)
#肚子
w.create_oval(62,132,138,193,fill='white')
w.create_arc(70,128,130,183,start=183,extent=174,fill='white')
#项圈
w.create_line(62,131,138,131,fill='black',capstyle=ROUND,width=9)
w.create_line(62,131,138,131,fill='red',capstyle=ROUND,width=7)
w.create_oval(92,131,108,147,fill='yellow')
w.create_oval(98,139,102,143,fill='brown')
w.create_line(100,142,100,147,fill='brown')
w.create_line(91,136,109,136,fill='black',width=3)
w.create_line(92,136,108,136,fill='yellow',width=1)
mainloop()
|
|