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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
complete = 1
reviewdate = "24 May 1998"
name = """
entry field with up and down arrow buttons
"""
description = """
A counter contains an entry field and two arrow buttons to
increment and decrement the value in the entry field. Standard
counting types include numbers, times and dates. A user defined
counting function may also be supplied for specialised counting.
Counting can be used in combination with the entry field's
validation. The components may be laid out horizontally or
vertically.
Each time an arrow button is pressed the value displayed in the
entry field is incremented or decremented by the value of the
*increment* option. If the new value is invalid (according to the
entry field's *validate* option, perhaps due to exceeding minimum
or maximum limits), the old value is restored.
When an arrow button is pressed and the value displayed is not an
exact multiple of the *increment*, it is "truncated" up or down to
the nearest increment.
"""
no_auto_default = ('datatype',)
text = {}
text['options'] = {}
text['options']['autorepeat'] = """
If true, the counter will continue to count up or down while an
arrow button is held pressed down.
"""
text['options']['buttonaspect'] = """
Specifies the width of the arrow buttons as a proportion of their
height. Values less than *1.0* will produce thin arrow buttons.
Values greater than *1.0* will produce fat arrow buttons.
"""
text['options']['datatype'] = """
Specifies how the counter should count up and down.
The most general way to specify the *datatype* option is as a
dictionary. The kind of counting is specified by the *'counter'*
dictionary field, which may be either a function or the name of
one of the standard counters described below. If the dictionary
does not have a *'counter'* field, the field defaults to
*'numeric'*.
Any other fields in the dictionary are passed on to the 'counter'
function as keyword arguments.
If *datatype* is not a dictionary, then it is equivalent to
specifying it as a dictionary with a single *'counter'* field.
For example, /datatype = 'real'/ is equivalent to
/datatype = {'counter' : 'real'}/.
The standard counters are:
*'numeric'* -- An integer number, as accepted by /int()/.
*'integer'* -- Same as *'numeric'*.
*'real'* -- A real number, as accepted by /float()/. This
counter accepts a *'separator'* argument, which specifies
the character used to represent the decimal point. The
default *'separator'* is *'.'*.
*'time'* -- A time specification, as accepted by
/Pmw.timestringtoseconds()/. This counter accepts a
*'separator'* argument, which specifies the character used to
separate the time fields. The default separator is *':'*.
This counter also accepts a *'time24'* argument. If this is
true, the time value is converted to a value between
*'00:00:00'* and *'23:59:59'*. The default is false.
*'date'* -- A date specification, as accepted by
/Pmw.datestringtojdn()/. This counter accepts a *'separator'*
argument, which specifies the character used to separate the
three date fields. The default is *'/'*. This counter also
accepts a *'fmt'* argument, which is passed to
/Pmw.datestringtojdn()/ to specify the desired ordering of the
fields. The default is *'ymd'*.
This counter also accepts a *'yyyy'* argument. If this is
false, the year field will be displayed as the year within the
century, otherwise it will be fully displayed. In both cases
it will be displayed with at least 2 digits, using leading
zeroes. The default is false.
If the *'counter'* dictionary field is a function, then it will be
called whenever the counter is to be incremented or decremented.
The function is called with at least three arguments, the first
three being ('text', 'factor', 'increment'), where 'text' is the
current contents of the entry field, 'factor' is *1* when
incrementing or *-1* when decrementing, and 'increment' is the
value of the *increment* megawidget option.
The other arguments are keyword arguments made up of the fields of
the *datatype* dictionary (excluding the *'counter'* field).
The 'counter' function should return a string representing the
incremented or decremented value. It should raise a
*ValueError* exception if the 'text' is invalid. In this case the
bell is rung and the entry text is not changed.
The default for *datatype* is *numeric*.
"""
text['options']['increment'] = """
Specifies how many units should be added or subtracted when the
counter is incremented or decremented. If the currently displayed
value is not a multiple of *increment*, the value is changed to
the next multiple greater or less than the current value.
For the number datatypes, the value of *increment* is a number.
For the *'time'* datatype, the value is in seconds. For the
*'date'* datatype, the value is in days.
"""
text['options']['initwait'] = """
Specifies the initial delay (in milliseconds) before a depressed
arrow button automatically starts to repeat counting.
"""
text['options']['orient'] = """
Specifies whether the arrow buttons should appear to the left and
right of the entry field (*'horizontal'*) or above and below
(*'vertical'*).
"""
text['options']['padx'] = """
Specifies a padding distance to leave around the arrow buttons in
the x direction.
"""
text['options']['pady'] = """
Specifies a padding distance to leave around the arrow buttons in
the y direction.
"""
text['options']['repeatrate'] = """
Specifies the delay (in milliseconds) between automatic counts
while an arrow button is held pressed down.
"""
text['options']['sticky'] = """
A combination of *'n'*, *'s'*, *'e'* and *'w'* which is used to
position the *frame* and *entryfield* components within the
*hull* component.
"""
text['components'] = {}
text['components']['downarrow'] = """
The arrow button used for decrementing the counter. Depending on
the value of *orient*, it will appear on the left or below the
entry field.
"""
text['components']['entryfield'] = """
The entry field widget where the text is entered, displayed and
validated.
"""
text['components']['frame'] = """
If the *label* component has been created (that is, the *labelpos*
option is not *None*), the *frame* component is created to act as
the container of the entry field and arrow buttons. If there is
no *label* component, then no *frame* component is created and the
*hull* component acts as the container. In either case the border
around the container of the entry field and arrow buttons will be
raised (but not around the label).
"""
text['components']['uparrow'] = """
The arrow button used for incrementing the counter. Depending on
the value of *orient*, it will appear on the right or above the
entry field.
"""
text['methods'] = {}
text['methods']['decrement'] = """
Decrement the counter once, as if the down arrow had been pressed.
"""
text['methods']['increment'] = """
Increment the counter once, as if the up arrow had been pressed.
"""
|