File: symchooser.rst

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (101 lines) | stat: -rwxr-xr-x 2,568 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.. _symchoos:

SymChooser
----------



.. class:: SymChooser


    Syntax:
        ``h.SymChooser()``

        ``h.SymChooser(caption)``

        ``h.SymChooser("caption", "varname")``


    Description:
        This class allows you to display a list of all names and variables in the system.  From this 
        list, you can simply select the name which you want to implement. 
        \ ``Symchooser()`` becomes especially convenient when you must keep track of many variables, 
        or when the names of 
        your variables become too long to type over and over again. 
         
        This symbol chooser object appears the same as the PlotWhat chooser of Graphs. 
         
        When the second argument is the name of a variable, a single panel SymChooser 
        is generated that is restricted to all names of the same type as that variable. 
        Useful arguments might be "hh" to see all distributed mechanism names, 
        "Graph" to see all Templates, "soma" to see all section names, or "v" to see 
        all range variable names. 
         

    Example:

        .. code::

            scobj = h.SymChooser() 
            scobj.run() 

        puts the symbol chooser on the screen, giving you access to all existing variables, 
        sections, object references, and objects.  You can click on a specific symbol and then 
        click on the "accept" button to call the symbol in the interpreter.  If you click on 
        an object reference in the left-hand window, a list of all possible commands for that type 
        of object will appear in the middle window.  From this list you can choose a 
        command to execute. 

         

----



.. method:: SymChooser.run


    Syntax:
        ``scobj.run()``


    Description:
        Pops up the SymChooser dialog. See PlotWhat for usage. 
        Returns 0 if cancel chosen, 1 for accept. 

         

----



.. method:: SymChooser.text


    Syntax:
        ``scobj.text(strdef)``


    Description:
        Places the text of last choice in *strdef*. This must be a reference to a HOC-style
        string not a Python string; see the example.

    Example:

        .. code::

            from neuron import h, gui

            h('create soma')
            h.soma.insert('hh')

            scobj = h.SymChooser()
            scobj.run()

            # read the result
            resultPtr = h.ref('')
            scobj.text(resultPtr)
            print('You selected: ' + resultPtr[0])

        .. image:: ../../images/symchooser.png
            :align: center