]> SALOME platform Git repositories - tools/eficas.git/blob - Pmw/Pmw_1_2/doc/TimeCounter.html
Salome HOME
Modif V6_4_°
[tools/eficas.git] / Pmw / Pmw_1_2 / doc / TimeCounter.html
1
2     <html>
3     <head>
4     <meta name="description" content="Pmw - a toolkit for building high-level compound widgets in Python">
5     <meta name="content" content="python, megawidget, mega widget, compound widget, gui, tkinter">
6     <title>Pmw.TimeCounter reference manual</title>
7     </head>
8
9     <body bgcolor="#ffffff" text="#000000" link="#0000ee"
10         vlink="551a8b" alink="ff0000">
11
12     <h1 ALIGN="CENTER">Pmw.TimeCounter</h1>
13     
14 <center><IMG SRC=TimeCounter.gif ALT="" WIDTH=170 HEIGHT=85></center>
15 <dl>
16 <dt> <h3>Name</h3></dt><dd>
17 <p>Pmw.TimeCounter() - 
18     counter for display and input of time
19 </p>
20
21
22 </dd>
23 <dt> <h3>Inherits</h3></dt><dd>
24 <a href="MegaWidget.html">Pmw.MegaWidget</a><br>
25 </dd>
26 <dt> <h3>Description</h3></dt><dd>
27 <p>
28     A time counter is similar to a regular <a href="Counter.html">Pmw.Counter</a> except that the
29     user may increment and decrement the hours, minutes and seconds
30     individually.</p>
31
32 <p></p>
33
34
35 </dd>
36 <dt> <h3>Options</h3></dt><dd>
37 Options for this megawidget and its base
38 classes are described below.<p></p>
39 <a name=option.autorepeat></a>
40 <dl><dt> <strong>autorepeat
41 </strong></dt><dd>
42 If true, the counter will continue to count up or down while an
43     arrow button is held pressed down. The default is <strong>1</strong>.</p>
44
45
46 </dd></dl>
47 <a name=option.buttonaspect></a>
48 <dl><dt> <strong>buttonaspect
49 </strong></dt><dd>
50 Initialisation option. Specifies the width of the arrow buttons as a proportion of their
51     height.  Values less than <strong>1.0</strong> will produce thin arrow buttons. 
52     Values greater than <strong>1.0</strong> will produce fat arrow buttons. The default is <strong>1.0</strong>.</p>
53
54
55 </dd></dl>
56 <a name=option.command></a>
57 <dl><dt> <strong>command
58 </strong></dt><dd>
59 This specifies a function to call whenever the <strong>&lt;Return&gt;</strong> key is
60     pressed in one of the entry fields or <code>invoke()</code> is called. The default is <strong>None</strong>.</p>
61
62
63 </dd></dl>
64 <a name=option.initwait></a>
65 <dl><dt> <strong>initwait
66 </strong></dt><dd>
67 Specifies the initial delay (in milliseconds) before a depressed
68     arrow button automatically starts to repeat counting. The default is <strong>300</strong>.</p>
69
70
71 </dd></dl>
72 <a name=option.labelmargin></a>
73 <dl><dt> <strong>labelmargin
74 </strong></dt><dd>
75 Initialisation option. If the <strong>labelpos</strong> option is not <strong>None</strong>, this specifies the
76         distance between the <strong>label</strong> component and the rest of the
77         megawidget. The default is <strong>0</strong>.</p>
78
79
80 </dd></dl>
81 <a name=option.labelpos></a>
82 <dl><dt> <strong>labelpos
83 </strong></dt><dd>
84 Initialisation option. Specifies where to place the <strong>label</strong> component.  If not
85         <strong>None</strong>, it should be a concatenation of one or two of the
86         letters <strong>'n'</strong>, <strong>'s'</strong>, <strong>'e'</strong> and <strong>'w'</strong>.  The first letter
87         specifies on which side of the megawidget to place the label. 
88         If a second letter is specified, it indicates where on that
89         side to place the label.  For example, if <strong>labelpos</strong> is <strong>'w'</strong>,
90         the label is placed in the center of the left hand side; if
91         it is <strong>'wn'</strong>, the label is placed at the top of the left
92         hand side; if it is <strong>'ws'</strong>, the label is placed at the
93         bottom of the left hand side.</p>
94 <p>        If <strong>None</strong>, a label component is not created. The default is <strong>None</strong>.</p>
95
96
97
98 </dd></dl>
99 <a name=option.max></a>
100 <dl><dt> <strong>max
101 </strong></dt><dd>
102 Specifies the maximum acceptable time in the form "HH:MM:SS", or
103     <strong>None</strong> if no maximum checking should be performed. The default is <strong>None</strong>.</p>
104
105
106 </dd></dl>
107 <a name=option.min></a>
108 <dl><dt> <strong>min
109 </strong></dt><dd>
110 Specifies the minimum acceptable time in the form "HH:MM:SS", or
111     <strong>None</strong> if no minimum checking should be performed. The default is <strong>None</strong>.</p>
112
113
114 </dd></dl>
115 <a name=option.padx></a>
116 <dl><dt> <strong>padx
117 </strong></dt><dd>
118 Initialisation option. Specifies how much wider to make each column than the default
119     width (where a column consists of two arrows and an entry field). 
120     The entry fields expand to fill the extra space, but the arrow
121     buttons are centered in the available space. The default is <strong>0</strong>.</p>
122
123
124 </dd></dl>
125 <a name=option.pady></a>
126 <dl><dt> <strong>pady
127 </strong></dt><dd>
128 Initialisation option. Specifies how much higher to make each row of arrow buttons than
129     the default hight.  The arrow buttons are centered in the
130     available space. The default is <strong>0</strong>.</p>
131
132
133 </dd></dl>
134 <a name=option.repeatrate></a>
135 <dl><dt> <strong>repeatrate
136 </strong></dt><dd>
137 Specifies the delay (in milliseconds) between automatic counts
138     while an arrow button is held pressed down. The default is <strong>50</strong>.</p>
139
140
141 </dd></dl>
142 <a name=option.value></a>
143 <dl><dt> <strong>value
144 </strong></dt><dd>
145 Initialisation option. Specifies the initial contents of the time counter, in the form
146     "HH:MM:SS".  If this is <strong>None</strong>, the current time is used as the
147     initial contents. The default is <strong>None</strong>.</p>
148
149
150 </dd></dl>
151 </dd>
152 <dt> <h3>Components</h3></dt><dd>
153 Components created by this megawidget and its base
154 classes are described below.<p></p>
155 <a name=component.downhourarrow></a>
156 <dl><dt> <strong>downhourarrow
157 </strong></dt><dd>
158 The arrow button used for decrementing the hour field. By default, this component is a Tkinter.Canvas. Its component group is <strong>Arrow</strong>.</p>
159
160
161 </dd></dl>
162 <a name=component.downminutearrow></a>
163 <dl><dt> <strong>downminutearrow
164 </strong></dt><dd>
165 The arrow button used for decrementing the minute field. By default, this component is a Tkinter.Canvas. Its component group is <strong>Arrow</strong>.</p>
166
167
168 </dd></dl>
169 <a name=component.downsecondarrow></a>
170 <dl><dt> <strong>downsecondarrow
171 </strong></dt><dd>
172 The arrow button used for decrementing the second field. By default, this component is a Tkinter.Canvas. Its component group is <strong>Arrow</strong>.</p>
173
174
175 </dd></dl>
176 <a name=component.frame></a>
177 <dl><dt> <strong>frame
178 </strong></dt><dd>
179 If the <strong>label</strong> component has been created (that is, the <strong>labelpos</strong>
180     option is not <strong>None</strong>), the <strong>frame</strong> component is created to act as
181     the container of the entry fields and arrow buttons.  If there is
182     no <strong>label</strong> component, then no <strong>frame</strong> component is created and the
183     <strong>hull</strong> component acts as the container.  In either case the border
184     around the container of the entry fields and arrow buttons will be
185     raised (but not around the label). By default, this component is a Tkinter.Frame.</p>
186
187
188 </dd></dl>
189 <a name=component.hourentryfield></a>
190 <dl><dt> <strong>hourentryfield
191 </strong></dt><dd>
192 The entry field where the hours are entered and displayed. By default, this component is a <a href="EntryField.html">Pmw.EntryField</a>.</p>
193
194
195 </dd></dl>
196 <a name=component.hull></a>
197 <dl><dt> <strong>hull
198 </strong></dt><dd>
199 This acts as the body for the entire megawidget.  Other components
200     are created as children of the hull to further specialise this
201     class. By default, this component is a Tkinter.Frame.</p>
202
203
204 </dd></dl>
205 <a name=component.label></a>
206 <dl><dt> <strong>label
207 </strong></dt><dd>
208 If the <strong>labelpos</strong> option is not <strong>None</strong>, this component is
209         created as a text label for the megawidget.  See the
210         <strong>labelpos</strong> option for details.  Note that to set, for example,
211         the <strong>text</strong> option of the label, you need to use the <strong>label_text</strong>
212         component option. By default, this component is a Tkinter.Label.</p>
213
214
215 </dd></dl>
216 <a name=component.minuteentryfield></a>
217 <dl><dt> <strong>minuteentryfield
218 </strong></dt><dd>
219 The entry field where the minutes are entered and displayed. By default, this component is a <a href="EntryField.html">Pmw.EntryField</a>.</p>
220
221
222 </dd></dl>
223 <a name=component.secondentryfield></a>
224 <dl><dt> <strong>secondentryfield
225 </strong></dt><dd>
226 The entry field where the seconds are entered and displayed. By default, this component is a <a href="EntryField.html">Pmw.EntryField</a>.</p>
227
228
229 </dd></dl>
230 <a name=component.uphourarrow></a>
231 <dl><dt> <strong>uphourarrow
232 </strong></dt><dd>
233 The arrow button used for incrementing the hour field. By default, this component is a Tkinter.Canvas. Its component group is <strong>Arrow</strong>.</p>
234
235
236 </dd></dl>
237 <a name=component.upminutearrow></a>
238 <dl><dt> <strong>upminutearrow
239 </strong></dt><dd>
240 The arrow button used for incrementing the minute field. By default, this component is a Tkinter.Canvas. Its component group is <strong>Arrow</strong>.</p>
241
242
243 </dd></dl>
244 <a name=component.upsecondarrow></a>
245 <dl><dt> <strong>upsecondarrow
246 </strong></dt><dd>
247 The arrow button used for incrementing the second field. By default, this component is a Tkinter.Canvas. Its component group is <strong>Arrow</strong>.</p>
248
249
250 </dd></dl>
251 </dd>
252 <dt> <h3>Component aliases</h3></dt><dd>
253 Sub-components of components of this megawidget
254 may be accessed via the following aliases.<p></p>
255 <dl><dt> <strong>hourentry
256 </strong></dt><dd>
257 Alias for <strong>hourentryfield_entry</strong>.
258 </dd></dl>
259 <dl><dt> <strong>minuteentry
260 </strong></dt><dd>
261 Alias for <strong>minuteentryfield_entry</strong>.
262 </dd></dl>
263 <dl><dt> <strong>secondentry
264 </strong></dt><dd>
265 Alias for <strong>secondentryfield_entry</strong>.
266 </dd></dl>
267 </dd>
268 <a name=methods></a>
269 <dt> <h3>Methods</h3></dt><dd>
270 Only methods specific to this megawidget are described below.
271 For a description of its inherited methods, see the
272 manual for its base class
273 <strong><a href="MegaWidget.html#methods">Pmw.MegaWidget</a></strong>.
274 <p></p>
275 <a name=method.decrement></a>
276 <dl><dt> <strong>decrement</strong>(<em>seconds</em> = <strong>1</strong>)</dt><dd>
277 Decrement the time by <em>seconds</em> seconds.</p>
278
279
280 </dd></dl>
281 <a name=method.getint></a>
282 <dl><dt> <strong>getint</strong>()</dt><dd>
283 Return the currently displayed time as a number of seconds.</p>
284
285
286 </dd></dl>
287 <a name=method.getstring></a>
288 <dl><dt> <strong>getstring</strong>()</dt><dd>
289 Same as <code>getvalue()</code> method.</p>
290
291
292 </dd></dl>
293 <a name=method.getvalue></a>
294 <dl><dt> <strong>getvalue</strong>()</dt><dd>
295 Return the currently displayed time as a string in the form
296     "HH:MM:SS".</p>
297
298
299 </dd></dl>
300 <a name=method.increment></a>
301 <dl><dt> <strong>increment</strong>(<em>seconds</em> = <strong>1</strong>)</dt><dd>
302 Increment the time by <em>seconds</em> seconds.</p>
303
304
305 </dd></dl>
306 <a name=method.invoke></a>
307 <dl><dt> <strong>invoke</strong>()</dt><dd>
308 Invoke the command specified by the <strong>command</strong> option as if the
309     <strong>&lt;Return&gt;</strong> key had been pressed.</p>
310
311
312 </dd></dl>
313 <a name=method.setvalue></a>
314 <dl><dt> <strong>setvalue</strong>(<em>text</em>)</dt><dd>
315 Set the contents of the time counter, where <em>text</em> must be in the
316     form "HH:MM:SS".</p>
317
318
319 </dd></dl>
320 </dd>
321 <dt> <h3>Example</h3></dt><dd>
322 The image at the top of this manual is a snapshot
323 of the window (or part of the window) produced
324 by the following code.<p></p>
325 <pre>
326 class Demo:
327     def __init__(self, parent):
328         self._time = Pmw.TimeCounter(parent,
329                 labelpos = 'w',
330                 label_text = 'HH:MM:SS',
331                 min = '00:00:00',
332                 max = '23:59:59')
333         self._time.pack(padx=10, pady=5)
334
335         button = Tkinter.Button(parent, text = 'Show', command = self.show)
336         button.pack()
337
338     def show(self):
339         stringVal = self._time.getstring()
340         intVal =  self._time.getint()
341         print stringVal + '  (' + str(intVal) + ')'
342
343 </pre>
344 </dd>
345 </dl>
346
347     <center><P ALIGN="CENTER">
348     <IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5>
349     </p></center>
350     
351
352     <font size=-1>
353     <center><P ALIGN="CENTER">
354     Pmw 1.2 -
355      5 Aug 2003
356      - <a href="index.html">Home</a>
357     <br>Manual page last reviewed: 25 May 2002
358     </p></center>
359     </font>
360
361     </body>
362     </html>
363