YAHOO! It makes sense and works GREAT! Thank you Pavel! This will make
the greatest robot EVER! hehe


-----Original Message-----
From: Pavel Kosina
Sent: Thursday, May 04, 2006 10:41 AM
To: [email protected]
Subject: Re: [Tkinter-discuss] How to Reference many Canvas Ovals

Hi, electron

> EHLO! Anyone have code showing how to reference many individual Canvas
> objects? 

put them into list

> for i in range(1,number+1)
> n[i] = canvas.create_oval()
> 

instead of this, there should be something like
all=[]
for i in range(1000):
        x,y=random.randint(0,X), random.randint(0,Y)
        o=canvas.create_oval((x,y,x+10,y+10), fill='red')
        all.append(o)

> and
> if variable[i] == "blue" then canvas.n[i].config(fill='blue')
> 

no, again, if you want to change color of 578th :-) oval, do it this
way:

canvas.itemconfig(all[578-1], fill='pink')


-- 
Pavel Kosina

_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to