For example, the List object's browser method takes a strdef and a function that is called repeatedly which is supposed to change the strdef to define list labels.
In the following code, it seems that gui_string_ is being copied instead of passed by reference, so the List browser does not see the changes. (All items are named "initial")
Code: Select all
from neuron import h, gui
h('strdef gui_string_')
h('gui_string_ = "initial"')
def name_it():
h('gui_string_ = "obj %d"' % h.hoc_ac_)
listbox = h.List()
for i in xrange(3):
listbox.append(h.Random())
listbox.browser('title', h.gui_string_, 'nrnpython("name_it()")')
Code: Select all
from neuron import h, gui
h('strdef gui_string_')
h('gui_string_ = "initial"')
def name_it():
h('gui_string_ = "obj %d"' % h.hoc_ac_)
listbox = h.List()
h('objref listbox')
h.listbox = listbox
for i in xrange(3):
listbox.append(h.Random())
h('listbox.browser("title", gui_string_, "nrnpython(\\"name_it()\\")")')