tkinter之旅(四)
Canvas
画布:画布基于一个结构化的图形对象模型,所有在画布上的东西都是对象。可以在画布中进行像素级别的操作,也可以嵌入组件(形状、图片等)。- 常规绘制:
# 实际返回的id是数字
id = canvas.create_line(from_x, from_y, to_x, to_y)
id = canvas.create_oval(from_x, from_y, to_x, to_y)
id = canvas.create_arc(from_x, from_y, to_x, to_y)
id = canvas.create_rectangle(from_x, from_y, to_x, to_y)
id = canvas.create_image(x, y, image=img, anchor=S)
id = canvas.create_window(x, y, window=widget)
id = canvas.create_text(x, y, text