File: secbrows.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 (153 lines) | stat: -rwxr-xr-x 3,343 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
.. _secbrows:

SectionBrowser
--------------



.. class:: SectionBrowser


    Syntax:
        ``sb = h.SectionBrowser()``

        ``sb = h.SectionBrowser(SectionList)``


    Description:
        Class that makes a visible list of all section names. 
        If the optional SectionList arg is present then only those 
        section names are shown in the browser. 

    Example:

        .. code-block::
            python

            from neuron import h, gui
            soma = h.Section(name='soma')
            dend = h.Section(name='dend')
            sl = h.SectionList([soma])  # only the soma will be shown
            sb = h.SectionBrowser(sl)
            
    
    .. image:: ../../images/secbrows-sectionList.png
        :align: center

    .. seealso::
        :class:`SectionList`, :ref:`stdrun_shape`

         

----



.. method:: SectionBrowser.select


    Syntax:
        ``.select(sec=section)``


    Description:
        specified section is highlighted. 

    Example:

        .. code-block::
            python

            from neuron import h, gui
            soma = h.Section(name='soma')
            axon = h.Section(name='axon')

            sb = h.SectionBrowser()
            sb.select(sec=axon)        

    .. image:: ../../images/secbrows-select.png
        :align: center
----



.. method:: SectionBrowser.select_action


    Syntax:
        ``sb.select_action(python_func)``


    Description:
        A Python function is executed when an item is selected (single click or 
        dragging) by the mouse. Before execution, the selected section 
        is pushed. (and	popped after the function completes.)
        A Python function is executed in the object context in which \ ``select_action`` 
        registered it. 


    Example:

        .. code-block::
            python

            from neuron import h, gui
            soma = h.Section(name='soma')
            axon = h.Section(name='axon')

            def select(sec):
                print('select: {} {}'.format(sec, type(sec)))

            def accept(sec):
                print('accept: {}'.format(sec))

            sb = h.SectionBrowser()
            sb.select_action(select)
            sb.accept_action(accept)

    .. note::

        Python support for :meth:`select_action` was added in NEURON 7.5.
         

----



.. method:: SectionBrowser.accept_action


    Syntax:
        ``sb.accept_action(python_func)``


    Description:
        A Python function is executed when an item is accepted (double click) by 
        the mouse. Before execution, the selected section 
        is pushed. (and	popped after the function completes.) 
        A Python function is executed in the object context in which the  ``accept_action`` 
        registered it. 

             
    Example:

        .. code-block::
            python

            from neuron import h, gui
            soma = h.Section(name='soma')
            axon = h.Section(name='axon')

            def select(sec):
                print('select: {} {}'.format(sec, type(sec)))

            def accept(sec):
                print('accept: {}'.format(sec))

            sb = h.SectionBrowser()
            sb.select_action(select)
            sb.accept_action(accept)

    .. note::

        Python support for :meth:`accept_action` was added in NEURON 7.5.