----- Mensaje original ----
> De: Christopher Barker <[email protected]>
> Para: Mailing List for the wxPython Float Canvas. <[email protected]>
> Enviado: miércoles, 25 de marzo, 2009 19:25:55
> Asunto: Re: [fc] FloatCanvas update issues
>
> Vitor Bosshard wrote:
> > It's attached. I managed to keep it at ~100 lines.
>
> I've take a look. It seems to work fine for me on OS-X, anyway.
>
> A few comments, though:
>
> def UpdateCircles(self, coord):
> self.RemoveObjects(self.circles)
> self.circles = []
> for i in range(25):
> self.circles.append(self.AddCircle((coord[0]+i%5*5,coord[1]+i),
> Diameter=10,
> LineColor="White"))
>
>
> DrawObjects have a Move() method, so that you can move them without removing
> them and re-creating them. There is also a SetPoint method, if you want to
> set
> their center points to a specific value:
>
> for i, circle in enumerate(self.Circles):
> circle.SetPoint((coord[0]+i%5*5,coord[1]+i))
>
>
> You also might want to put all the Circles in a Group object, but then you
> have
> to use Move(), rather than SetPoint.
>
> I've enclosed an edited version.
>
> -Chris
>
I'll look at the approaches you mention. I got the idea to recreate all objects
every frame because the objects I'm drawing might be different every time, so
this simplified my code a lot. Your comments got me thinking of better
approaches, though. Thanks for the pointers!
Vitor
¡Sé el Bello 51 de People en Español! ¡Es tu oportunidad de Brillar! Sube
tus fotos ya. http://www.51bello.com/
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas