The code that performs the task is as follows :
Code: Select all
from neuron import *
from nrn import *
from time import sleep
# Load a saved seesion with morphology
h('load_file("./morphologies/morphologySession.hoc")')
# Create a shape with the loaded morphology
h('objref sectionList')
h('sectionList = new SectionList()')
h('soma[0] sectionList.subtree()')
h('objref shape')
h('shape = new Shape(sectionList)')
#Color each dendrite branch in orange
for i in range (len(h.dend)):
h('access dend[' + str(i) + ']')
h.shape.color(5)
sleep(0.1)
# Print to screen so we know the program runs
print(i)
I have tried to use flush() or observe() within the loop and increasing the sleep time, but neither had any effect.
My question is, what should be changed in the above implementation in order to see the color changes occur in real time (and not wait for the end of the iteration to observe the changes)?
Thanks!