Tkinter.Canvas.create_line.coords

Anton Vredegoor anton at vredegoor.doge.nl
Sun Jun 1 07:59:01 EDT 2003


Arnd Baecker <arnd.baecker at web.de> wrote:

<unquoted lines are edited>

>    def action(self):
>        print "action2, This one fails:"
>        liste=[10,0,10,10,80,100,100,200]
         self.plot.coords(self.plot.line,*liste)
>
>    def createWidgets(self):
>	self.QUIT = Button(self, text='QUIT', foreground='red',
>			   command=self.quit)
>
>	self.Action = Button(self, text='Action', foreground='red',
>			   command=self.action)
>        self.plot=Canvas(self, width="5i", height="5i")
>        liste=[0,0,10,10,80,150,200,200]
        self.plot.line=self.plot.create_line(liste)
>
>	self.plot.pack(side=TOP)
>	self.QUIT.pack(side=LEFT, fill=BOTH)
>	self.Action.pack(side=LEFT, fill=BOTH)

Bengts suggestion about unpacking the argument solves one problem.
Changing self.line into self.plot.line solves the next problem. 

By the way, reading your code (and Bengts reply) gave me some ideas,
so we're having a win-win situation here. If you'd stop mixing spaces
and tabs this would work even better ...

Anton




More information about the Python-list mailing list