"Ketan Maheshwari" <[EMAIL PROTECTED]> wrote > of this class created using a constructor. The constructor > essentially > creates the circles and the update mathod makes them move randomly. > However, at each updation, I want to access each circle to know its > coordinates. At the moment I am not able to do that.
The circles are stored in a list called items. You can iterate over the items printing out their centres: for circ in items: print circ.getCentres() Where getCentres is a mrethod you will need to write and add to Circle! :-) > class Circle: > def __init__(self, canvas, xy, ink, delta): > def __call__(self): > def move(self): > > root = Tk() ... > canvas = Canvas(frame, width=200, height=200, bd=0, > highlightthickness=0) > canvas.pack() > > items = [ > Circle(canvas, (60, 70), "blue", 1), > Circle(canvas, (100, 120), "green", 1), > ] > ... > for i in range(len(items)): > items[i] = items[i]() As is done here except it would be prettier done as for i in items: HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor