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 » Wed Nov 02, 2011 4:22 pm

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: 5514
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 » Wed Nov 02, 2011 7:30 pm

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 » Wed Nov 02, 2011 9:19 pm

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: 1572
Joined: Wed May 18, 2005 3:32 pm

Re: Getting gui to stay open when importing NEURON

Post by hines » Thu Nov 03, 2011 4:35 pm

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 » Thu Nov 03, 2011 8:07 pm

Neat! It works.

Post Reply