Hello,

Would like to understand the "best" way to animate / move text on an wxAgg
frame. The following demo code adds text to a random location for each
button interrupt. How best to change this code so that the text is added
only once, and then efficiently move this text to a new random location
for each button interrupt (using perhaps blit, without recreating the
canvas??)? If this has been answered before, please point me to the
thread. Thank you, Doug.

Code...

class MyNavigationToolbar(NavigationToolbar2WxAgg):
  ON_CUSTOM = wx.NewId()
  def __init__(self, canvas):
    NavigationToolbar2WxAgg.__init__(self, canvas)
    self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_left.xpm'),
'Click me')
    wx.EVT_TOOL(self, self.ON_CUSTOM, self._on_custom)

  def _on_custom(self, evt):
    ax = self.canvas.figure.axes[0]
    x,y = tuple(np.random.rand(2))
    rgb = tuple(np.random.rand(3))
    ax.text(x, y, 'You clicked me', transform=ax.transAxes, color=rgb)
    self.canvas.draw()
    evt.Skip()
.
.
.
toolbar = MyNavigationToolbar(canvas)
toolbar.Realize()





------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to