Page 1 of 1

Getting gui to stay open when importing NEURON

Posted: Wed Nov 02, 2011 4:22 pm
by bhalterm
Is there a way to keep the gui open for user interaction when importing neuron in a python script using

Code: Select all

import neuron
from neuron import gui
similar to how it stays open when using nrngui -python?

Re: Getting gui to stay open when importing NEURON

Posted: Wed Nov 02, 2011 7:30 pm
by ted
I suppose you could execute the hoc command
nrnmainmenu()
from Python to get the NEURON Main Menu toolbar, if that's what you want.

Re: Getting gui to stay open when importing NEURON

Posted: Wed Nov 02, 2011 9:19 pm
by bhalterm
The menu bar appears, but the problem is that python exits at the end of the script instead of remaining open for user interaction.

Thanks for the fast response!

Re: Getting gui to stay open when importing NEURON

Posted: Thu Nov 03, 2011 4:35 pm
by hines
I've occasionally wondered about that myself. Googling
interactive python after file
gave a result that mentions:

When a script file is used, it is sometimes useful to be able to run the script and enter interactive mode afterwards. This can be done by passing -i before the script.

But I haven't tried it yet.

Re: Getting gui to stay open when importing NEURON

Posted: Thu Nov 03, 2011 8:07 pm
by bhalterm
Neat! It works.