如何使用Tkinter画布绘制鱼?

时间:2019-06-13 13:42:54

标签: python tkinter tkinter-canvas

我正在尝试使用tkinter使用定义的Canvas类在碗中画一条鱼。我画了一个立方体,完成了50%的工作,但是在把鱼放在碗里时我需要帮助。如何使用Tkinter画布画一条鱼?请帮帮我!

这是我想要实现的

Link

这是我的代码:


from tkinter import *
root = Tk()
root.title('graphics')

canv = Canvas(root, width = 800, height = 800, bg = "white", cursor = "pencil")

canv.create_line(150, 250, 450, 250, width = 2, fill = "black")
canv.create_line(150, 550, 450, 550, width = 2, fill = "black")
canv.create_line(150, 250, 150, 550, width = 2, fill = "black")
canv.create_line(450, 250, 450, 550, width = 2, fill = "black")

canv.create_line(300, 150, 600, 150, width = 2, fill = "black")
canv.create_line(300, 450, 600, 450, width = 2, fill = "black")
canv.create_line(300, 150, 300, 450, width = 2, fill = "black")
canv.create_line(600, 150, 600, 450, width = 2, fill = "black")

canv.create_line(150, 250, 300, 150, width = 2, fill = "black")
canv.create_line(450, 250, 600, 150, width = 2, fill = "black")
canv.create_line(150, 550, 300, 450, width = 2, fill = "black")
canv.create_line(450, 550, 600, 450, width = 2, fill = "black")

canv.create_line(150, 300, 300, 200, width = 2, fill = "black")
canv.create_line(450, 300, 600, 200, width = 2, fill = "black")
canv.create_line(150, 300, 450, 300, width = 2, fill = "black")
canv.create_line(300, 200, 600, 200, width = 2, fill = "black")

canv.pack()
root.mainloop()

0 个答案:

没有答案
相关问题