画以上图形的代码在下面,请自行阅读,作业: 请说出以上图形中每个点的坐标。
from tkinter import * root = Tk() # 创建窗口 cv = Canvas(root,width=480,height=360,bg='white') # 创建画布 cv.pack() # 放置画布 cv.create_line(0,180,480,180,fill='gray',width=1) # 创建线条 cv.create_line(240,0,240,360,fill='gray',width=1) # 创建线条 cv.create_line(480,0,0,360,fill='gray',width=1) # 创建线条 cv.create_line(0,0,480,360,fill='gray',width=1) # 创建线条 # 以矩形(长方形)的左上角和右下角坐标来唯一确定一个矩形) cv.create_rectangle(190,130,290,230,fill='cyan',width=2) # 创建矩形 # 创建圆形,以最小包围矩形的左上角和右下角来唯一确定一个矩形 cv.create_oval(190,130,290,230,fill='white',width=2) # 创建矩形 cv.create_rectangle(0,0,100,100,fill='pink',width=2) # 创建矩形 cv.create_rectangle(380,0,480,100,fill='pink',width=2) # 创建矩形 cv.create_rectangle(0,260,100,360,fill='pink',width=2) # 创建矩形 cv.create_rectangle(380,260,480,360,fill='pink',width=2) # 创建矩形 root.mainloop()