Tkinter:如何更新Canvas create_polygon?

时间:2017-04-03 08:39:44

标签: python tkinter tkinter-canvas

我试图在点击按钮时更新画布中的多边形并且它不起作用。

class UpdatePoly(Frame):      

    def __init__(self, master = None):
      Frame.__init__(self, master, width=400, height=700)
      self.grid(column=0, row=0, columnspan=3, rowspan=6,sticky=(N, S, E, W))
      self.canvas = Canvas(self, width=400, height=600,background="#ffffff")
      # self.canvas.configure(scrollregion=self.canvas.bbox("all"))
      self.points = [0,0,0,2,2,4,7,9]
      self.map_ = self.canvas.create_polygon(self.points)
      self.canvas.grid(column=0, row=0, sticky="nsew")

   def process(self):
     # new co-ordinates
     self.points = [3,4,6,9,4,5,9,0]         
     self.canvas.itemconfig(self.canvas.create_polygon(self.points))

我做错了什么?

0 个答案:

没有答案