On Mon, Oct 4, 2010 at 10:46 AM, Ademir Francisco da Silva
<ademirfs_...@inteligweb.com.br> wrote:
> Hi John ..., I hope everything goes well ...
>
> ( This message is only for you ... )
>
> I have decided to wrote this email to know if you have been working in "
> widget module " ..., as you know by 2 months ago I asked you about this and
> nothing happend since it yet. I have got the latest version of the
> matplotlib and numpy directly of the Christoph's site and after installed
> all of them my insight about it is that nothing changed, so I kindly ask you
> about your advance in resolve those problems. Just see my last 4 emails sent
> to you and matplotlib list.
>
> Summary ...
> ( snippet of my original code - Before they work fine but now the " cursor "
> just disappear and the " on_clicked " is not works )
> widgets.Cursor( axe, useblit = True, color = self.cor[ 477 ][ 1 ], lw = 2 )
> widgets.Button( pyplot.axes( [ .91, .1, .08, .06 ] ), self.textName[ 19 ],
>              color = self.cor[ 403 ][ 1 ], hovercolor = self.cor[ 46 ][ 1 ]
> ).\
>              on_clicked( lambda: pyplot.close( "all" ) )


There is a recent fix in matplotlib svn that fixes the bug you may be
seeing.  Specifically, if you do not save the names of the widgets you
are creating, the callbacks can disappear.  So you will want to do
something like

  mycursor = widgets.Cursor( axe, useblit = True, color = self.cor[
477 ][ 1 ], lw = 2 )
  mybutton = widgets.Button( pyplot.axes( [ .91, .1, .08, .06 ] ),
self.textName[ 19 ], ...)

Basically, if the names of the classes go out of scope, they are
garbage collected because we are using weak references internally to
make sure callbacks get cleaned up when they go out of scope.  So if
you are creating these variables and module level, make sure they are
names with a local variable, and if you are creating them at the class
level, make sure they are saved as an instance variable.

JDH

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to