Getting gui to stay open when importing NEURON

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
bhalterm
Posts: 52
Joined: Wed Mar 08, 2006 10:43 am
Location: University of Pennsylvania

Getting gui to stay open when importing NEURON

Post 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?
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Getting gui to stay open when importing NEURON

Post 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.
bhalterm
Posts: 52
Joined: Wed Mar 08, 2006 10:43 am
Location: University of Pennsylvania

Re: Getting gui to stay open when importing NEURON

Post 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!
hines
Site Admin
Posts: 1687
Joined: Wed May 18, 2005 3:32 pm

Re: Getting gui to stay open when importing NEURON

Post 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.
bhalterm
Posts: 52
Joined: Wed Mar 08, 2006 10:43 am
Location: University of Pennsylvania

Re: Getting gui to stay open when importing NEURON

Post by bhalterm »

Neat! It works.
Post Reply