Problem using xpvalue
Posted: Wed Dec 15, 2010 6:47 pm
I'm having trouble calling xpvalue from python using a reference to a value in hoc.
init.hoc:
simplepanel.hoc:
content.py:
Instead of creating the xpvalue I see the following error
Am I making the call improperly or is something else happening? (if you comment out the xpvalue than the rest works fine)
init.hoc:
Code: Select all
load_file("simplepanel.hoc")
objref sp
sp = new SimplePanel()
sp.showopt()
Code: Select all
begintemplate SimplePanel
public showopt
objref optbox, p, this
proc init() {
foo = 1
bar = 2
}
strdef tstr
proc showopt() {
optbox = new VBox()
xpanel("Simple Panel")
xpvalue("Foo", &foo)
p = new PythonObject()
nrnpython("import content")
p.content.showopt(this)
xpanel()
optbox.map()
}
endtemplate SimplePanelCode: Select all
import neuron
def showopt(hObj):
h = neuron.hoc.HocObject()
h.xbutton("Works", "nrnpython(\"print \\\"works\\\"\")")
print hObj.bar
print hObj._ref_bar
h.xpvalue("Bar", hObj._ref_bar)
Code: Select all
nrngui init.hoc
NEURON -- VERSION 7.2 (469+:e613810284ee+) 2010-09-15
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2008
See http://www.neuron.yale.edu/credits.html
nrniv: unable to open font "*helvetica-medium-r-normal*--14*", using "fixed"
1
2.0
<hoc.HocObject object at 0xe60468>
/usr/bin/nrniv: Segmentation violation
in init.hoc near line 5
sp.showopt()
^
xpvalue("Bar", ...)
SimplePanel[0].showopt()
Traceback (most recent call last):
File "content.py", line 8, in showopt
h.xpvalue("Bar", hObj._ref_bar)
RuntimeError: hoc error
/usr/bin/nrniv: PyObject method call failed: showopt
in init.hoc near line 5
^
SimplePanel[0].showopt()
initcode failed with 1 left