graph - Tuple index out of range Tkinter -
so i've got program should take function input , graph on tkinter canvas.
def draw(self): self.canvas.delete(all) n, in enumerate(self.sav): self.function, colour = self.sav_func[n] = self.p1(i) = self.p2(i, self.function, colour) if != [0]: try: self.canvas.create_line(i, fill = colour) except tclerror err: tkmessagebox.showerror(tclerror, err) self.sav.remove(self.sav[len(self.sav)-1]) self.sav_func.remove(self.sav_func[len(self.sav_func)-1]) this section giving me following error:
exception in tkinter callback traceback (most recent call last): file "c:\python27\lib\lib-tk\tkinter.py", line 1410, in __call__ return self.func(*args) file "d:/google drive/assign2_2-1.py", line 113, in add_func self.redraw_all() file "d:/google drive/assign2_2-1.py", line 132, in redraw_all self.draw() file "d:/google drive/assign2_2-1.py", line 145, in draw self.canvas.create_line(i, fill = colour) file "c:\python27\lib\lib-tk\tkinter.py", line 2201, in create_line return self._create('line', args, kw) file "c:\python27\lib\lib-tk\tkinter.py", line 2182, in _create cnf = args[-1] indexerror: tuple index out of range from can gather it's number of inputs not matching number of outputs, i'm still little lost. great!
it looks i doesn't have enough values. create line needs 4 values: x1,y1,x2,y2.
Comments
Post a Comment