I'm animating a Circle patch with a varying center and radius, and I
noticed that changing the ``radius`` attribute has no effect on the
patch. Currently, ``radius`` is only used to instantiate an Ellipse
object, but updating radius has no effect (i.e. redrawing the patch
doesn't use the new radius).
I've included a patch to add this feature. Also included in the patch
is a small fix to one of the UI examples (sorry for included a
completely unrelated patch but the fix seemed to small for a separate
email).
BTW, I'm using a property idiom from: http://code.activestate.com/recipes/205183/
. I thought that this approach was better than polluting the namespace
with getters and setters, especially since this would differ from the
way the Ellipse class uses ``width`` and ``height`` attributes.
Cheers,
-Tony
===================================================================
--- lib/matplotlib/patches.py (revision 7128)
+++ lib/matplotlib/patches.py (working copy)
@@ -1131,6 +1131,14 @@
self.radius = radius
Ellipse.__init__(self, xy, radius*2, radius*2, **kwargs)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
+
+ def radius():
+ def fget(self):
+ return self.width / 2.
+ def fset(self, radius):
+ self.width = self.height = 2 * radius
+ return locals()
+ radius = property(**radius())
class Arc(Ellipse):
"""
Index: examples/user_interfaces/embedding_in_wx3.py
===================================================================
--- examples/user_interfaces/embedding_in_wx3.py (revision 7128)
+++ examples/user_interfaces/embedding_in_wx3.py (working copy)
@@ -147,7 +147,7 @@
return True
def OnBang(self,event):
- bang_count = XRCCTRL(self.frame,"bang_count")
+ bang_count = xrc.XRCCTRL(self.frame,"bang_count")
bangs = bang_count.GetValue()
bangs = int(bangs)+1
bang_count.SetValue(str(bangs))
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel