Code:

using PyPlot
using PyCall
@pyimport matplotlib as plt
fig = plt.gcf()
function onclick(event)
    println("down", event) 
end
cid_up=fig[:canvas][:mpl_connect]("button_press_event",onclick)
plot.show()


Error:

PyError (:PyObject_Call) <type 'exceptions.TypeError'>
TypeError("cannot create weak reference to 'PyCall.jl_Function' object",)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 
2316, in mpl_connect
    return self.callbacks.connect(s, func)
  File "/usr/lib64/python2.7/site-packages/matplotlib/cbook.py", line 506, in 
connect
    self._func_cid_map[s][func] = cid
  File "/usr/lib64/python2.7/weakref.py", line 321, in __setitem__
    self.data[ref(key, self._remove)] = value

while loading In[5], in expression starting on line 1

 in pyerr_check at /home/emerson/.julia/v0.3/PyCall/src/exception.jl:60
 in pycall at /home/emerson/.julia/v0.3/PyCall/src/PyCall.jl:92
 in fn at /home/emerson/.julia/v0.3/PyCall/src/conversions.jl:188



Thanks

Em terça-feira, 21 de julho de 2015 16:23:30 UTC-3, Isaiah escreveu:
>
> Please describe what you tried and what was the error. You may need to 
> either 1) yield the event loop 2) make sure the program stays open long 
> enough to actually display your plot (ref: 
> https://github.com/stevengj/PyPlot.jl/issues/41)
>
> On Tue, Jul 21, 2015 at 2:53 PM, Emerson Vitor Castelani <
> emerso...@gmail.com <javascript:>> wrote:
>
>> I had a similar problem...I don't know why...
>>
>>
>> Em terça-feira, 21 de julho de 2015 14:46:41 UTC-3, El suisse escreveu:
>>>
>>> Hi 
>>> I got the following example related with this thread
>>>
>>> https://gist.github.com/elsuizo/5338605a6a5c7ab54730
>>>
>>> but fail in
>>>
>>>
>>> https://gist.github.com/elsuizo/5338605a6a5c7ab54730#file-phase_portrait_mouse_event-jl-L114
>>>
>>> and I do not know why
>>>
>>> This is the python code which comes:
>>>
>>> https://gist.github.com/elsuizo/6957889d8e63e9029377
>>>
>>
>

Reply via email to