-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't "connect" to events, PyCall can't create weak references to Julia function #21
Comments
I do really need to connect a signal in fig[:canvas] using fig[:canvas][:mpl_connect]. However, I am getting this same error message. I am trying to get the position of a mouse click over a plot. Is there any way to solve the problem now? Thanks, |
This is due to JuliaPy/PyCall.jl#158, and looks like it requires some implementation work in PyCall to support Python weak references to Julia objects. |
Ok, thanks @stevengj. |
Hi! Did something change? I was able to connect an event to a Julia function using the Here is an example: using PyCall
pygui(:qt5)
using PyPlot
function test(event)
println("Click: $(event[:xdata]), $(event[:ydata])")
end
fig = figure()
plot(0:1:10, 0:1:10)
fig[:canvas][:mpl_connect]("button_press_event", test) Then, after clicking on the figure, I see:
|
What Julia/PyCall version were you using for that? Did you also test on linux? |
I was using Julia 0.6.2 and latest released version of PyCall in openSUSE linux. I tested it on macOS and Linux. In linux, I performed a test using different versions of Python and QT5. Everything worked. You can see this package here: |
Unfortunately in my setup (ubuntu 14.04, tried Python 3.4 and 2.7) it also doesn't work with your example.
|
One question, did you install matplotlib from pip? |
I am trying to "connect" to PyPlot events so I can visually inspect some plots and extract peaks from 1D spectra.
I tried the following
Looking through the PyPlot code it seems like
connect
should work in this instance, but I have not been able to find any examples of people using this function, so I am not sure if it is functional.The text was updated successfully, but these errors were encountered: