I think I see your problem... see below:

class start_lasso():
    def __init__(self):
        data = [Datum(*xy) for xy in rand(100, 2)]

        fig = figure()
        ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1),
autoscale_on=False)
        lman = LassoManager(ax, data)
        show()

You aren't saving any of the objects created in the "start_lasso" class to
your start_lasso object.  Luckily, with the way pyplot works, the figure
object your create gets implicitly saved to the "pyplot state manager" (a
sort of smart global location for the figure objects), and the axes object
gets implicitly attached to the figure object.  Therefore, when the python
execution goes out of this scope, the figure object and the axes do not get
garbage-collected.  However, the lasso widget that gets created and all the
callbacks that were attached are all done with weak references to the
figure and axes.  So when you leave this scope, the LassoManager no longer
exists and the callback fails to execute (as designed).

So, make sure that at least lman (and possibly fig and ax) gets saved to
the start_lasso object to solve that part of the problem.  Next, you don't
save the start_lasso object your create anywhere, so even if you saved lman
to start_lasso, the start_lasso object gets garbage-collected anyway as a
temporary.

I hope this is clear.  Let me know if you still have more issues.

Cheers!
Ben Root
------------------------------------------------------------------------------
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