Skip to content

Latest commit

 

History

History
executable file
·
93 lines (62 loc) · 2.19 KB

dialog.rst

File metadata and controls

executable file
·
93 lines (62 loc) · 2.19 KB

Dialog Boxes

boolean_dialog

Syntax:

h.boolean_dialog("label", ["accept", "cancel"])
Description:

Pops up a dialog window at the center of the screen and blocks everything until dealt with. Returns 1 or 0.

Example:

from neuron import h, gui

if h.boolean_dialog('Do you prefer to code in Python or HOC?', 'Python', 'HOC'):
    print('You prefer Python!')
else:
    print('You prefer HOC!')

image

SymChooser, VBox.dialog


continue_dialog

Syntax:

h.continue_dialog("message")
Description:

Provides information to the user. Like boolean_dialog, blocks everything until dealt with.

Example:

from neuron import h, gui
h.continue_dialog("You are reading a message from a dialog box.")

image


string_dialog

Syntax:
h.string_dialog("message", strref)
Description:

Prompts the user to enter a string. The initial value of strref is used as the default value. If canceled, returns 0 and strref remains unchanged. Otherwise, returns 1 and strref is replaced with the entered text. Like boolean_dialog, blocks everything until dealt with.

Example:

from neuron import h, gui

my_str = h.ref('')
if h.string_dialog('Type a string:', my_str):
    print('You typed: %s' % my_str[0])
else:
    print('You canceled')

image