Debian Codegraph @

doc-en/source/src/api/Interface/ctoggle.rst

raw
1 ctoggle : creates a two-states button
2 =====================================
3
4 Initline
5 ---------
6
7 .. code::
8
9 ctoggle(name='toggle', label='Start/Stop', init=True, rate='k',
10 stack=False, col='red', help='')
11
12 Description
13 ------------
14
15 A toggle button is a two-states switch that can be used to start and stop
16 processes.
17
18 If `rate` argument is set to 'i', a built-in reserved variable is created
19 at initialization time. The variable's name is constructed like this :
20
21
22 .. code::
23
24 self.widget_name + '_value'
25
26 If `name` is set to 'foo', the variable's name will be:
27
28
29 .. code::
30
31 self.foo_value
32
33 If `rate` argument is set to 'k', a module method using one argument
34 must be defined with the name `name`. If `name` is set to 'foo', the
35 function should be defined like this :
36
37
38 .. code::
39
40 def foo(self, value):
41
42 value is an integer (0 or 1).
43
44 Parameters
45 -----------
46
47 **name**: str
48 Name of the widget used to defined the function or the
49 reserved variable.
50 **label**: str
51 Label shown in the interface.
52 **init**: int
53 Initial state of the toggle.
54 **rate**: str {'k', 'i'}
55 Indicates if the toggle is handled at initialization time only
56 ('i') with a reserved variable or with a function ('k') that can
57 be called at any time during playback.
58 **stack**: boolean
59 If True, the toggle will be added on the same row as the last
60 toogle with stack=True and a label not empty. Defaults to False.
61 **col**: str
62 Color of the widget.
63 **help**: str
64 Help string shown in the toggle tooltip.
65
66