File: OptionMenu_text.py

package info (click to toggle)
python-pmw 2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,968 kB
  • sloc: python: 42,737; makefile: 4
file content (123 lines) | stat: -rw-r--r-- 3,490 bytes parent folder | download | duplicates (2)
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
complete = 1
reviewdate = "23 October 1998"

name = """
    single item selection megawidget
"""

description = """
    An option menu consists of a menu button
    and an associated menu which pops up when the button is pressed. 
    The text displayed in the menu button is updated whenever an item
    is selected in the menu.  The currently selected value can be
    retrieved from the megawidget.

"""

text = {}
text['options'] = {}

text['options']['command'] = """
    Specifies a function to call whenever a menu item is selected or
    the /invoke()/ method is called.  The function is called with the
    currently selected value as its single argument.

"""

text['options']['initialitem'] = """
    Specifies the initial selected value.  This option is treated in
    the same way as the 'index' argument of the /setitems()/ method.

"""

text['options']['items'] = """
    A sequence of strings containing the initial items to be displayed
    in the *menu* component.

"""

text['options']['sticky'] = """
    A combination of *'n'*, *'s'*, *'e'* and *'w'* which is used to
    position the *menubutton* component within the *hull* component.

"""

text['components'] = {}

text['components']['menubutton'] = """
    The menu button displaying the currently selected value.

"""

text['components']['menu'] = """
    The popup menu displayed when the *menubutton* is pressed.

"""

text['methods'] = {}

text['methods']['getvalue'] = """
    Return the currently selected value.

"""

text['methods']['setvalue'] = """
    Set the text displayed by the *menubutton* component to 'text'.
    
"""

text['methods']['setitems'] = """
    Replace all the items in the *menu* component with those specified
    by 'items', which must be a sequence of strings.
    
    If 'index' is not *None*, set the selected value to 'index', which
    may have any of the forms accepted by the /index()/ method.

    If 'index' is *None* and the *textvariable* option of the
    *menubutton* component is the empty string, then if
    the previous selected value is one of the 'items', then do not
    change the selection.  If the previous selected value is no longer
    in 'items', then set the selected value to the first value in
    'items'.  If 'items' is empty, set the selected value to the empty
    string.

    If 'index' is *None* and the *textvariable* option of the
    *menubutton* component is not the empty string, then do not set
    the selected value.  This assumes that the variable is already (or
    will be) set to the desired value.
    
"""

text['methods']['getcurselection'] = """
    Same as /getvalue()/ method.
    
"""

text['methods']['index'] = """
    Return the numerical index of the menu item corresponding to
    'index'.  This may be specified in any of the following forms:

    'name' --
	 Specifies the menu item labelled 'name'.

    'number' --
	 Specifies the menu item numerically, where *0* corresponds to
         the first menu item.

    *Pmw.END* --
	 Specifies the last menu item.

    *Pmw.SELECT* --
	 Specifies the currently selected menu item.

"""

text['methods']['invoke'] = """
    Calling this method is the same as selecting the menu item
    specified by 'index':  the text displayed by the
    *menubutton* component is updated and the function specified by
    the *command* option is called.  'index' may have any of the
    forms accepted by the /index()/ method.  The value returned by
    *command* is returned.
    
"""