On Wed, Sep 5, 2012 at 7:19 PM, Mark Budde <markbu...@gmail.com> wrote:

> Hi,
> I'm not an expert so please go easy on me. I am using the pyplot lasso
> demo, and have got it to work how I would like. I am having a problem,
> however, where I cannot get it to work if my python file is not the
> main file (where __name__ is not __main__).
>
> I took the part at the bottom in the "if __name__ == '__main__':" and
> put it into a class. Everything works fine if I call the class from
> within the same file. However, if I call the class from another file,
> the graph loads fine but the lasso tool does not work. Troubleshooting
> revealed that LassoManager.onpress is not being called when I click
> the mouse. Any suggestions are welcome because this is driving me
> crazy!
> Thanks,
> Mark
>
>
Hi Mark,

I can't seem to reproduce your issue, but it's a bit difficult without
seeing how exactly you wrapped up the "main" part of the code. Just
guessing: maybe the two cases aren't *exactly* the same.

Is it possible that you have ``lman`` (the LassoManager instance) defined
in the same block of code as ``show`` in one case but not the other? If,
for example, ``lman`` is defined in a method of your class, but not saved
anywhere then it'll get discarded after the method finishes. So ``show``
would need to be called inside that method, or saved as a class attribute.

Like I said, that's just a wild guess. You should paste the class def if
you're still having problems.

Best
-Tony

P.S. If you're running matplotlib from Github master, you might be
interested in an alternative lasso tool  (LassoSelector) that may be
simpler to use.:
https://github.com/matplotlib/matplotlib/blob/master/examples/widgets/lasso_selector_demo.py
------------------------------------------------------------------------------
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