Commit | Line | Data |
---|---|---|
920dae64 AT |
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 functions 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 functions</h1> | |
13 | ||
14 | <dl> | |
15 | <dt> <strong>Pmw.aboutcontact</strong>(<em>value</em>)</dt><dd> | |
16 | <p> | |
17 | The value passed to this function is used to construct the text | |
18 | displayed by <a href="AboutDialog.html">Pmw.AboutDialog</a> megawidgets created subsequently.</p> | |
19 | ||
20 | <p></p> | |
21 | ||
22 | ||
23 | </dd> | |
24 | <dt> <strong>Pmw.aboutcopyright</strong>(<em>value</em>)</dt><dd> | |
25 | <p> | |
26 | The value passed to this function is used to construct the text | |
27 | displayed by <a href="AboutDialog.html">Pmw.AboutDialog</a> megawidgets created subsequently.</p> | |
28 | ||
29 | <p></p> | |
30 | ||
31 | ||
32 | </dd> | |
33 | <dt> <strong>Pmw.aboutversion</strong>(<em>value</em>)</dt><dd> | |
34 | <p> | |
35 | The value passed to this function is used to construct the text | |
36 | displayed by <a href="AboutDialog.html">Pmw.AboutDialog</a> megawidgets created subsequently.</p> | |
37 | ||
38 | <p></p> | |
39 | ||
40 | ||
41 | </dd> | |
42 | <dt> <strong>Pmw.aligngrouptags</strong>(<em>groups</em>)</dt><dd> | |
43 | <p> | |
44 | This function takes a sequence of <a href="Group.html">Pmw.Group</a>s and adjusts the | |
45 | vertical position of the tags in each group so that they all have | |
46 | the height of the tallest tag. This can be used when groups are | |
47 | positioned side-by-side but the natural height of the tags are | |
48 | different because, for example, different fonts with different | |
49 | sizes are used.</p> | |
50 | ||
51 | <p></p> | |
52 | ||
53 | ||
54 | </dd> | |
55 | <dt> <strong>Pmw.alignlabels</strong>(<em>widgets</em>, <em>sticky</em> = <strong>None</strong>)</dt><dd> | |
56 | <p> | |
57 | Adjust the size of the labels of all the <em>widgets</em> to be equal, so | |
58 | that the body of each widget lines up vertically. This assumes | |
59 | that each widget is a megawidget with a <strong>label</strong> component in | |
60 | column 0 (ie, the <strong>labelpos</strong> option was set to <strong>'w'</strong>, <strong>'wn'</strong> or | |
61 | <strong>'ws'</strong>). If <em>sticky</em> is set to a combination of <strong>'n'</strong>, <strong>'s'</strong>, | |
62 | <strong>'e'</strong> and <strong>'w'</strong>, the label will be positioned within its cell | |
63 | accordingly. For example to make labels right justified, set | |
64 | <em>sticky</em> to <strong>'e'</strong>, <strong>'ne'</strong> or <strong>'se'</strong>.</p> | |
65 | ||
66 | <p></p> | |
67 | ||
68 | ||
69 | </dd> | |
70 | <dt> <strong>Pmw.alphabeticvalidator</strong>(<em>text</em>)</dt><dd> | |
71 | <p> | |
72 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>alphabetic</strong> standard validator.</p> | |
73 | ||
74 | <p></p> | |
75 | ||
76 | ||
77 | </dd> | |
78 | <dt> <strong>Pmw.alphanumericvalidator</strong>(<em>text</em>)</dt><dd> | |
79 | <p> | |
80 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>alphanumeric</strong> standard validator.</p> | |
81 | ||
82 | <p></p> | |
83 | ||
84 | ||
85 | </dd> | |
86 | <dt> <strong>Pmw.busycallback</strong>(<em>command</em>, <em>updateFunction</em> = <strong>None</strong>)</dt><dd> | |
87 | <p> | |
88 | Create a wrapper function which displays a busy cursor while | |
89 | executing <em>command</em> and return the wrapper. When the wrapper | |
90 | function is called, it first calls <code>Pmw.showbusycursor()</code>, then | |
91 | the <em>command</em> (passing any arguments to it), then <code>Pmw.hidebusycursor()</code>. | |
92 | The return value of <em>command</em> is returned from the wrapper.</p> | |
93 | ||
94 | <p> If <em>updateFunction</em> is specified, it is called just before the | |
95 | call to <code>Pmw.hidebusycursor()</code>. This is intended to be the | |
96 | Tkinter <code>update()</code> method, in which case it will clear any events | |
97 | that may have occurred while <em>command</em> was executing. An example | |
98 | of this usage is in the <code>ShowBusy</code> demonstration: run the | |
99 | demonstration, click on the entry widget then click on the button | |
100 | and type some characters while the busy cursor is displayed. No | |
101 | characters should appear in the entry widget.</p> | |
102 | ||
103 | <p> Note that the Tkinter <code>update()</code> method should only be called when | |
104 | it is known that it can be safely called. One case where a | |
105 | problem has been found is when a filehandler has been created (on | |
106 | a non-blocking Oracle database connection), but the filehandler | |
107 | does not read from the connection. The connection is read (by a | |
108 | call to the Oracle fetch function <em>ofen</em>) in a loop which also | |
109 | contains a call to <code>_tkinter.dooneevent()</code>. If <code>update()</code> is | |
110 | called from <code>dooneevent()</code> and there is data to be read on the | |
111 | connection, then the filehandler will be called continuously, thus | |
112 | hanging the application.</p> | |
113 | ||
114 | <p></p> | |
115 | ||
116 | ||
117 | </dd> | |
118 | <dt> <strong>Pmw.clearbusycursor</strong>()</dt><dd> | |
119 | <p> | |
120 | Unconditionally remove the event block and busy cursor from all | |
121 | windows. This undoes all outstanding calls to | |
122 | <code>Pmw.showbusycursor()</code>.</p> | |
123 | ||
124 | <p></p> | |
125 | ||
126 | ||
127 | </dd> | |
128 | <dt> <strong>Pmw.datestringtojdn</strong>(<em>text</em>, <em>format</em> = <strong>'ymd'</strong>, <em>separator</em> = <strong>'/'</strong>)</dt><dd> | |
129 | <p> | |
130 | Return the Julian Day Number corresponding to the date in <em>text</em>. | |
131 | A Julian Day Number is defined as the number of days since 1 Jan 4713 | |
132 | BC. The date must be specified as three integers separated by the | |
133 | <em>separator</em> character. The integers must be in the order specified by | |
134 | <em>format</em>, which must be a combination of <strong>'d'</strong>, <strong>'m'</strong> and <strong>'y'</strong> in | |
135 | any order. These give the order of the day, month and year | |
136 | fields. Examples of valid input are:</p> | |
137 | <dl><dd><pre> 'dmy': 31/01/99 31/1/1999 31/1/99 | |
138 | 'mdy': 01/31/99 1/31/1999 1/31/99 | |
139 | 'ymd': 99/01/31 1999/1/31 99/1/31</pre></dd></dl> | |
140 | ||
141 | ||
142 | <p> If the application's | |
143 | <em>pivot</em> year (default 50) is not <strong>None</strong> and the year specified | |
144 | in <em>text</em> has only one or two digits, then the year is | |
145 | converted to a four digit year. If it is less than or equal to | |
146 | the pivot year, then it is incremented by the application's | |
147 | <em>century</em> value (default 2000). If it is more than the pivot year | |
148 | then it is incremented by the <em>century</em> value less 100.</p> | |
149 | ||
150 | <p> The function <code>Pmw.setyearpivot()</code> can be used to change the | |
151 | default values for the application's | |
152 | <em>pivot</em> and <em>century</em>.</p> | |
153 | ||
154 | <p></p> | |
155 | ||
156 | ||
157 | </dd> | |
158 | <dt> <strong>Pmw.datevalidator</strong>(<em>text</em>, <em>format</em> = <strong>'ymd'</strong>, <em>separator</em> = <strong>'/'</strong>)</dt><dd> | |
159 | <p> | |
160 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>date</strong> standard validator.</p> | |
161 | ||
162 | <p></p> | |
163 | ||
164 | ||
165 | </dd> | |
166 | <dt> <strong>Pmw.displayerror</strong>(<em>text</em>)</dt><dd> | |
167 | <p> | |
168 | This is a general purpose method for displaying background errors | |
169 | to the user. The errors would normally be programming errors and | |
170 | may be caused by errors in Tk callbacks or functions called by other | |
171 | asynchronous events.</p> | |
172 | ||
173 | <p> If the global error report file (set by calling | |
174 | <code>Pmw.reporterrorstofile()</code>) is <strong>None</strong>, the error message `text` is | |
175 | written to standard error and also shown in a text window. If | |
176 | <code>displayerror</code> is called while previous error messages are being | |
177 | displayed, the window is raised and the new error is queued. The | |
178 | queued errors may be viewed by the user or ignored by dismissing | |
179 | the window.</p> | |
180 | ||
181 | <p> If the global error report file is not <strong>None</strong>, `text` is written | |
182 | to the file. <em>file</em> may be any object with a <code>write()</code> method, | |
183 | such as <code>sys.stderr</code>.</p> | |
184 | ||
185 | <p></p> | |
186 | ||
187 | ||
188 | </dd> | |
189 | <dt> <strong>Pmw.drawarrow</strong>(<em>canvas</em>, <em>color</em>, <em>direction</em>, <em>tag</em>, <em>baseOffset</em> = <strong>0.25</strong>, <em>edgeOffset</em> = <strong>0.15</strong>)</dt><dd> | |
190 | <p> | |
191 | Draw a triangle in the Tkinter.Canvas <em>canvas</em> in the given | |
192 | <em>color</em>. The value of <em>direction</em> may be <strong>'up'</strong>, <strong>'down'</strong>, | |
193 | <strong>'left'</strong> or <strong>'right'</strong> and specifies which direction the arrow | |
194 | should point. The values of <em>baseOffset</em> and <em>edgeOffset</em> specify | |
195 | how far from the edges of the canvas the points of the triangles | |
196 | are as a fraction of the size of the canvas.</p> | |
197 | ||
198 | <p></p> | |
199 | ||
200 | ||
201 | </dd> | |
202 | <dt> <strong>Pmw.forwardmethods</strong>(<em>fromClass</em>, <em>toClass</em>, <em>toPart</em>, <em>exclude</em> = <strong>()</strong>)</dt><dd> | |
203 | <p> | |
204 | Forward methods from one class to another.</p> | |
205 | ||
206 | <p> This function adds methods to the class <em>fromClass</em>. The names of | |
207 | the methods added are the names of the methods of the class | |
208 | <em>toClass</em> (and its base classes) except those which are already | |
209 | defined by <em>fromClass</em> or are found in the <em>exclude</em> list. | |
210 | Special methods with one or more leading or trailing underscores | |
211 | are also excluded.</p> | |
212 | ||
213 | <p> When one of the added methods is called, the method of the same | |
214 | name is called on an instance defined by <em>toPart</em> and the return | |
215 | value passed back. If <em>toPart</em> is a string, then it specifies the | |
216 | name of an attribute (<em>not</em> a component) of the <em>fromClass</em> | |
217 | object. The class of this attribute should be <em>toClass</em>. If | |
218 | <em>toPart</em> is not a string, it must be a function taking a | |
219 | <em>fromClass</em> object and returning a <em>toClass</em> object.</p> | |
220 | ||
221 | <p> This function must be called outside of and after the definition | |
222 | of <em>fromClass</em>.</p> | |
223 | ||
224 | <p> For example:</p> | |
225 | ||
226 | <dl><dd><pre>class MyClass: | |
227 | def __init__(self): | |
228 | ... | |
229 | self.__target = TargetClass() | |
230 | ... | |
231 | ||
232 | def foo(self): | |
233 | pass | |
234 | ||
235 | def findtarget(self): | |
236 | return self.__target | |
237 | ||
238 | Pmw.forwardmethods(MyClass, TargetClass, '__target', | |
239 | ['dangerous1', 'dangerous2']) | |
240 | ||
241 | # ...or... | |
242 | ||
243 | Pmw.forwardmethods(MyClass, TargetClass, | |
244 | MyClass.findtarget, ['dangerous1', 'dangerous2'])</pre></dd></dl> | |
245 | ||
246 | <p> In both cases, all <code>TargetClass</code> methods will be forwarded from | |
247 | <code>MyClass</code> except for <code>dangerous1</code>, <code>dangerous2</code>, special methods like | |
248 | <code>__str__</code>, and pre-existing methods like <code>foo</code>.</p> | |
249 | ||
250 | <p></p> | |
251 | ||
252 | ||
253 | </dd> | |
254 | <dt> <strong>Pmw.grabstacktopwindow</strong>()</dt><dd> | |
255 | <p> | |
256 | Return the window at the top of the grab stack (the window | |
257 | currently with the grab) or <strong>None</strong> if the grab stack is empty (no | |
258 | window has the grab). See also <code>pushgrab()</code>.</p> | |
259 | ||
260 | <p></p> | |
261 | ||
262 | ||
263 | </dd> | |
264 | <dt> <strong>Pmw.hexadecimalvalidator</strong>(<em>text</em>)</dt><dd> | |
265 | <p> | |
266 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>hexadecimal</strong> standard validator.</p> | |
267 | ||
268 | <p></p> | |
269 | ||
270 | ||
271 | </dd> | |
272 | <dt> <strong>Pmw.hidebusycursor</strong>(<em>forceFocusRestore</em> = <strong>0</strong>)</dt><dd> | |
273 | <p> | |
274 | Undo one call to <code>Pmw.showbusycursor()</code>. If there are no | |
275 | outstanding calls to <code>Pmw.showbusycursor()</code>, remove the event | |
276 | block and busy cursor.</p> | |
277 | ||
278 | <p> If the focus window has not been changed since the corresponding | |
279 | call to <code>Pmw.showbusycursor()</code>, or if <em>forceFocusRestore</em> is true, | |
280 | then the focus is restored to that saved by <code>Pmw.showbusycursor()</code>.</p> | |
281 | ||
282 | <p></p> | |
283 | ||
284 | ||
285 | </dd> | |
286 | <dt> <strong>Pmw.initialise</strong>(<em>root</em> = <strong>None</strong>, <em>size</em> = <strong>None</strong>, <em>fontScheme</em> = <strong>None</strong>, <em>useTkOptionDb</em> = <strong>0</strong>, <em>noBltBusy</em> = <strong>0</strong>, <em>disableKeyboardWhileBusy</em> = <strong>None</strong>)</dt><dd> | |
287 | <p> | |
288 | Initialise Pmw. This performs several functions:</p> | |
289 | <ul><li><p>Set up a trap in the Tkinter Toplevel constructor so that a | |
290 | list of Toplevels can be maintained. A list of all Toplevel | |
291 | windows needs to be kept so that <code>Pmw.showbusycursor()</code> can | |
292 | create busy cursors for them.</p> | |
293 | ||
294 | </li> | |
295 | <li><p>Set up a trap in the Tkinter Toplevel and Frame destructors | |
296 | so that Pmw is notified when these widgets are destroyed. | |
297 | This allows Pmw to destroy megawidgets when their hull | |
298 | widget is destroyed and to prune the list of Toplevels.</p> | |
299 | ||
300 | </li> | |
301 | <li><p>Modify Tkinter's CallWrapper class to improve the display of | |
302 | errors which occur in callbacks. If an error occurs, the | |
303 | new CallWrapper class calls <code>Pmw.clearbusycursor()</code> to | |
304 | remove any outstanding busy cursors and calls | |
305 | <code>Pmw.displayerror()</code> to display the error.</p> | |
306 | ||
307 | </li> | |
308 | <li><p>Using the window given by <em>root</em>, set the <strong>WM_DELETE_WINDOW</strong> | |
309 | root window protocol to destroy the root window. This means | |
310 | that the root window is destroyed if the window manager | |
311 | deletes it. This is only done if the protocol has not been | |
312 | set before the call to <code>Pmw.initialise()</code>. This protocol is | |
313 | required if there is a modal dialog displayed and the window | |
314 | manager deletes the root window. Otherwise the application | |
315 | will not exit, even though there are no windows.</p> | |
316 | ||
317 | </li> | |
318 | <li><p>Set the base font size for the application to <em>size</em>. This | |
319 | is used by <code>Pmw.logicalfont()</code> as the default point size for | |
320 | fonts. If this is not given, the default is <strong>14</strong>, except | |
321 | under NT where it is <strong>16</strong>. These are reasonable default | |
322 | sizes for most screens, but for unusually high or low screen | |
323 | resolutions, an appropriate size should be supplied. Note | |
324 | that Tk's definition of <em>point size</em>, is somewhat | |
325 | idiosyncratic.</p> | |
326 | ||
327 | </li> | |
328 | <li><p>Set the Tk option database for <em>root</em> according to | |
329 | <em>fontScheme</em>. This changes the default fonts set by Tk. | |
330 | <em>fontScheme</em> may be one of</p> | |
331 | <dl><dt><strong>None</strong> </dt><dd>Do not change the Tk defaults.<p></p> | |
332 | ||
333 | </dd> | |
334 | <dt><strong>'pmw1'</strong> </dt><dd>If running under posix (Unix), set the default font to | |
335 | be Helvetica with bold italic menus, italic scales and | |
336 | a special balloon font 6 points smaller than the base | |
337 | font size and with the <strong>'pixel'</strong> field set to <strong>'12'</strong>. | |
338 | For other operating systems (such as NT or Macintosh), | |
339 | simply set the default font to be Helvetica. All | |
340 | fonts are as returned by calls to <code>Pmw.logicalfont()</code>.<p></p> | |
341 | ||
342 | </dd> | |
343 | <dt><strong>'pmw2'</strong> </dt><dd>This is the same as <strong>'pmw1'</strong> except that under posix | |
344 | the balloon font is 2 points smaller than the base | |
345 | font size and the <strong>'pixel'</strong> field is not set.<p></p> | |
346 | ||
347 | </dd> | |
348 | <dt><strong>'default'</strong> </dt><dd>This sets the default fonts using the Tk font naming | |
349 | convention, rather than that returned by | |
350 | <code>Pmw.logicalfont()</code>. The default font is bold | |
351 | Helvetica. The font for entry widgets is Helvetica. | |
352 | The font for text widgets is Courier The size of all | |
353 | fonts is the application base font size as described | |
354 | above.<p></p> | |
355 | ||
356 | </dd></dl> | |
357 | ||
358 | </li> | |
359 | <li><p>If <em>root</em> is <strong>None</strong>, use the Tkinter default root window as the | |
360 | root, if it has been created, or create a new Tk root window. | |
361 | The <code>initialise()</code> method returns this <em>root</em>.</p> | |
362 | ||
363 | </li> | |
364 | <li><p>If <em>useTkOptionDb</em> is true, then, when a megawidget is | |
365 | created, the Tk option database will be queried to get the | |
366 | initial values of the options which have not been set in | |
367 | the call to the constructor. The resource name used in the | |
368 | query is the same as the option name and the resource class | |
369 | is the option name with the first letter capitalised. If | |
370 | <em>useTkOptionDb</em> is false, then options for newly created | |
371 | megawidgets will be initialised to default values.</p> | |
372 | ||
373 | </li> | |
374 | <li><p>If <em>noBltBusy</em> is true, then <code>Pmw.showbusycursor()</code> will not | |
375 | display a busy cursor, even if the BLT busy command is | |
376 | present.</p> | |
377 | ||
378 | </li> | |
379 | <li><p>If <em>disableKeyboardWhileBusy</em> is false, then do not disable | |
380 | keyboard input while displaying the busy cursor. Normally, | |
381 | Pmw ignores keyboard input while displaying the busy cursor | |
382 | by setting the focus for each toplevel window to the Blt | |
383 | busy window. However, under NT, this may cause the toplevel | |
384 | windows to be raised. If this is not acceptable, programs | |
385 | running on NT can request show/hidebusycursor to not ignore | |
386 | keyboard input by setting <em>disableKeyboardWhileBusy</em> to true | |
387 | in <code>Pmw.initialise()</code>.</p> | |
388 | ||
389 | </li></ul> | |
390 | ||
391 | <p> It is not absolutely necessary to call this function to be able to use | |
392 | Pmw. However, some functionality will be lost. Most importantly, | |
393 | Pmw megawidgets will not be notified when their hull widget is | |
394 | destroyed. This may prevent the megawidget from cleaning up | |
395 | timers which will try to access the widget, hence causing a | |
396 | background error to occur.</p> | |
397 | ||
398 | <p></p> | |
399 | ||
400 | ||
401 | </dd> | |
402 | <dt> <strong>Pmw.installedversions</strong>(<em>alpha</em> = <strong>0</strong>)</dt><dd> | |
403 | <p> | |
404 | If <em>alpha</em> is false, return the list of base versions of Pmw | |
405 | that are currently installed and available for use. If <em>alpha</em> is | |
406 | true, return the list of alpha versions.</p> | |
407 | ||
408 | <p></p> | |
409 | ||
410 | ||
411 | </dd> | |
412 | <dt> <strong>Pmw.integervalidator</strong>(<em>text</em>)</dt><dd> | |
413 | <p> | |
414 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>integer</strong> standard validator.</p> | |
415 | ||
416 | <p></p> | |
417 | ||
418 | ||
419 | </dd> | |
420 | <dt> <strong>Pmw.jdntoymd</strong>(<em>jdn</em>, <em>julian</em> = <strong>-1</strong>, <em>papal</em> = <strong>1</strong>)</dt><dd> | |
421 | <p> | |
422 | Return the year, month and day of the Julian Day Number <em>jdn</em>. If | |
423 | <em>julian</em> is <strong>1</strong>, then the date returned will be in the Julian | |
424 | calendar. If <em>julian</em> is <strong>0</strong>, then the date returned will be in | |
425 | the modern calendar. If <em>julian</em> is <strong>-1</strong>, then which calendar to | |
426 | use will be automatically determined by the value of <em>jdn</em> and | |
427 | <em>papal</em>. If <em>papal</em> is true, then the date set by Pope Gregory | |
428 | XIII's decree (4 October 1582) will be used as the last day to use | |
429 | the Julian calendar. If <em>papal</em> is false, then the last day to | |
430 | use the Julian calendar will be according to British-American | |
431 | usage (2 September 1752).</p> | |
432 | ||
433 | <p></p> | |
434 | ||
435 | ||
436 | </dd> | |
437 | <dt> <strong>Pmw.logicalfont</strong>(<em>name</em> = <strong>'Helvetica'</strong>, <em>sizeIncr</em> = <strong>0</strong>, **<em>kw</em>)</dt><dd> | |
438 | <p> | |
439 | Return the full name of a Tk font, being a hyphen-separated list | |
440 | of font properties. The <em>logical</em> name of the font is given by | |
441 | <em>name</em> and may be one of <strong>'Helvetica'</strong>, <strong>'Times'</strong>, <strong>'Fixed'</strong>, | |
442 | <strong>'Courier'</strong> or <strong>'Typewriter'</strong>. Pmw uses this name to define the | |
443 | default values of many of the font properties. The size of the | |
444 | font is the base font size for the application specified in the | |
445 | call to <code>Pmw.initialise()</code> increased or decreased by the value of | |
446 | <em>sizeIncr</em>. The other properties of the font may be specified by | |
447 | other named arguments. These may be <strong>'registry'</strong>, <strong>'foundry'</strong>, | |
448 | <strong>'family'</strong>, <strong>'weight'</strong>, <strong>'slant'</strong>, <strong>'width'</strong>, <strong>'style'</strong>, | |
449 | <strong>'pixel'</strong>, <strong>'size'</strong>, <strong>'xres'</strong>, <strong>'yres'</strong>, <strong>'spacing'</strong>, | |
450 | <strong>'avgwidth'</strong>, <strong>'charset'</strong> and <strong>'encoding'</strong>.</p> | |
451 | ||
452 | <p></p> | |
453 | ||
454 | ||
455 | </dd> | |
456 | <dt> <strong>Pmw.logicalfontnames</strong>()</dt><dd> | |
457 | <p> | |
458 | Return the list of known logical font names that can be given | |
459 | to <code>Pmw.logicalfont()</code>.</p> | |
460 | ||
461 | <p></p> | |
462 | ||
463 | ||
464 | </dd> | |
465 | <dt> <strong>Pmw.numericvalidator</strong>(<em>text</em>)</dt><dd> | |
466 | <p> | |
467 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>numeric</strong> standard validator.</p> | |
468 | ||
469 | <p></p> | |
470 | ||
471 | ||
472 | </dd> | |
473 | <dt> <strong>Pmw.popgrab</strong>(<em>window</em>)</dt><dd> | |
474 | <p> | |
475 | Remove <em>window</em> from the grab stack. If there are not more | |
476 | windows in the grab stack, release the grab. Otherwise set the | |
477 | grab and the focus to the next window in the grab stack. See also | |
478 | <code>pushgrab()</code>.</p> | |
479 | ||
480 | <p></p> | |
481 | ||
482 | ||
483 | </dd> | |
484 | <dt> <strong>Pmw.pushgrab</strong>(<em>grabWindow</em>, <em>globalMode</em>, <em>deactivateFunction</em>)</dt><dd> | |
485 | <p> | |
486 | The grab functions (<code>pushgrab()</code>, <code>popgrab()</code>, <code>releasegrabs()</code> | |
487 | and <code>grabstacktopwindow()</code>) are an interface to the Tk <strong>grab</strong> | |
488 | command which implements simple pointer and keyboard grabs. When | |
489 | a grab is set for a particular window, Tk restricts all pointer | |
490 | events to the grab window and its descendants in Tk's window | |
491 | hierarchy. The functions are used by the <code>activate()</code> and | |
492 | <code>deactivate()</code> methods to implement modal dialogs.</p> | |
493 | ||
494 | <p> Pmw maintains a stack of grabbed windows, where the window on the | |
495 | top of the stack is the window currently with the grab. The grab | |
496 | stack allows nested modal dialogs, where one modal dialog can be | |
497 | activated while another modal dialog is activated. When the | |
498 | second dialog is deactivated, the first dialog becomes active | |
499 | again.</p> | |
500 | ||
501 | <p> Use <code>pushgrab()</code> to add <em>grabWindow</em> to the grab stack. This | |
502 | releases the grab by the window currently on top of the stack (if | |
503 | there is one) and gives the grab and focus to the <em>grabWindow</em>. | |
504 | If <em>globalMode</em> is true, perform a global grab, otherwise perform | |
505 | a local grab. The value of <em>deactivateFunction</em> specifies a | |
506 | function to call (usually grabWindow.deactivate) if popgrab() is | |
507 | called (usually from a deactivate() method) on a window which is | |
508 | not at the top of the stack (that is, does not have the grab or | |
509 | focus). For example, if a modal dialog is deleted by the window | |
510 | manager or deactivated by a timer. In this case, all dialogs | |
511 | above and including this one are deactivated, starting at the top | |
512 | of the stack.</p> | |
513 | ||
514 | <p> For more information, see the Tk grab manual page.</p> | |
515 | ||
516 | <p></p> | |
517 | ||
518 | ||
519 | </dd> | |
520 | <dt> <strong>Pmw.realvalidator</strong>(<em>text</em>, <em>separator</em> = <strong>'.'</strong>)</dt><dd> | |
521 | <p> | |
522 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>real</strong> standard validator.</p> | |
523 | ||
524 | <p></p> | |
525 | ||
526 | ||
527 | </dd> | |
528 | <dt> <strong>Pmw.releasegrabs</strong>()</dt><dd> | |
529 | <p> | |
530 | Release grab and clear the grab stack. This should normally not | |
531 | be used, use <code>popgrab()</code> instead. See also <code>pushgrab()</code>.</p> | |
532 | ||
533 | <p></p> | |
534 | ||
535 | ||
536 | </dd> | |
537 | <dt> <strong>Pmw.reporterrorstofile</strong>(<em>file</em> = <strong>None</strong>)</dt><dd> | |
538 | <p> | |
539 | Sets the global error report file, which is initially <strong>None</strong>. See | |
540 | <code>Pmw.displayerror()</code></p> | |
541 | ||
542 | <p></p> | |
543 | ||
544 | ||
545 | </dd> | |
546 | <dt> <strong>Pmw.setalphaversions</strong>(*<em>alpha_versions</em>)</dt><dd> | |
547 | <p> | |
548 | Set the list of alpha versions of Pmw to use for this session to | |
549 | the arguments. When searching for Pmw classes and functions, | |
550 | these alpha versions will be searched, in the order given, before | |
551 | the base version. This must be called before any other Pmw class | |
552 | or function, except functions setting or querying versions.</p> | |
553 | ||
554 | <p></p> | |
555 | ||
556 | ||
557 | </dd> | |
558 | <dt> <strong>Pmw.setbusycursorattributes</strong>(<em>window</em>, **<em>kw</em>)</dt><dd> | |
559 | <p> | |
560 | Use the keyword arguments to set attributes controlling the effect | |
561 | on <em>window</em> (which must be a <strong>Tkinter.Toplevel</strong>) of future calls | |
562 | to <code>Pmw.showbusycursor()</code>. The attributes are:</p> | |
563 | ||
564 | <dl><dt><strong>exclude</strong></dt><dd>a boolean value which specifies whether the window | |
565 | will be affected by calls to <code>Pmw.showbusycursor()</code>. If a window | |
566 | is excluded, then the cursor will not be changed to a busy cursor | |
567 | and events will still be delivered to the window. By default, | |
568 | windows are affected by calls to <code>Pmw.showbusycursor()</code>.<p></p> | |
569 | ||
570 | </dd> | |
571 | <dt><strong>cursorName</strong></dt><dd>the name of the cursor to use when displaying the | |
572 | busy cursor. If <strong>None</strong>, then the default cursor is used.<p></p> | |
573 | ||
574 | </dd></dl> | |
575 | <p></p> | |
576 | ||
577 | ||
578 | </dd> | |
579 | <dt> <strong>Pmw.setgeometryanddeiconify</strong>(<em>window</em>, <em>geom</em>)</dt><dd> | |
580 | <p> | |
581 | Deiconify and raise the toplevel <em>window</em> and set its position and | |
582 | size according to <em>geom</em>. This overcomes some problems with the | |
583 | window flashing under X and correctly positions the window under | |
584 | NT (caused by Tk bugs).</p> | |
585 | ||
586 | <p></p> | |
587 | ||
588 | ||
589 | </dd> | |
590 | <dt> <strong>Pmw.setversion</strong>(<em>version</em>)</dt><dd> | |
591 | <p> | |
592 | Set the version of Pmw to use for this session to <em>version</em>. If | |
593 | <code>Pmw.setversion()</code> is not called, the latest installed version of | |
594 | Pmw will be used. This must be called before any other Pmw class | |
595 | or function, except functions setting or querying versions.</p> | |
596 | ||
597 | <p></p> | |
598 | ||
599 | ||
600 | </dd> | |
601 | <dt> <strong>Pmw.setyearpivot</strong>(<em>pivot</em>, <em>century</em> = <strong>None</strong>)</dt><dd> | |
602 | <p> | |
603 | Set the pivot year and century for the application's date | |
604 | processing. These values are used in the <code>datestringtojdn()</code> | |
605 | method, which is used by <a href="Counter.html">Pmw.Counter</a> and <a href="EntryField.html">Pmw.EntryField</a> | |
606 | and derived classes. The initial values of <em>pivot</em> and <em>century</em> | |
607 | are <strong>50</strong> and <strong>2000</strong> repectively. Return a tuple containing the | |
608 | old values of <em>pivot</em> and <em>century</em>.</p> | |
609 | ||
610 | <p></p> | |
611 | ||
612 | ||
613 | </dd> | |
614 | <dt> <strong>Pmw.showbusycursor</strong>()</dt><dd> | |
615 | <p> | |
616 | Block events to and display a busy cursor over all windows in this | |
617 | application that are in the state <strong>'normal'</strong> or <strong>'iconic'</strong>, except | |
618 | those windows whose <strong>exclude</strong> busycursor attribute has been set to | |
619 | true by a call to <code>Pmw.setbusycursorattributes()</code>.</p> | |
620 | ||
621 | <p> If a window and its contents have just been created, | |
622 | <code>update_idletasks()</code> may have to be called before | |
623 | <code>Pmw.showbusycursor()</code> so that the window is mapped to the screen. | |
624 | Windows created or deiconified after calling | |
625 | <code>Pmw.showbusycursor()</code> will not be blocked.</p> | |
626 | ||
627 | <p> To unblock events and remove the busy cursor, use | |
628 | <code>Pmw.hidebusycursor()</code>. Nested calls to <code>Pmw.showbusycursor()</code> | |
629 | may be made. In this case, a matching number of calls to | |
630 | <code>Pmw.hidebusycursor()</code> must be made before the event block and | |
631 | busy cursor are removed.</p> | |
632 | ||
633 | <p> If the BLT extension to Tk is not present, this function has no | |
634 | effect other than to save the value of the current focus window, | |
635 | to be later restored by <code>Pmw.hidebusycursor()</code>.</p> | |
636 | ||
637 | <p></p> | |
638 | ||
639 | ||
640 | </dd> | |
641 | <dt> <strong>Pmw.stringtoreal</strong>(<em>text</em>, <em>separator</em> = <strong>'.'</strong>)</dt><dd> | |
642 | <p> | |
643 | Return the real number represented by <em>text</em>. This is similar to | |
644 | <code>string.atof()</code> except that the character representing the decimal | |
645 | point in <em>text</em> is given by <em>separator</em>.</p> | |
646 | ||
647 | <p></p> | |
648 | ||
649 | ||
650 | </dd> | |
651 | <dt> <strong>Pmw.timestringtoseconds</strong>(<em>text</em>, <em>separator</em> = <strong>':'</strong>)</dt><dd> | |
652 | <p> | |
653 | Return the number of seconds corresponding to the time in <em>text</em>. | |
654 | The time must be specified as three integers separated by the | |
655 | <em>separator</em> character and must be in the order hours, minutes and | |
656 | seconds. The first number may be negative, indicating a negative | |
657 | time.</p> | |
658 | ||
659 | <p></p> | |
660 | ||
661 | ||
662 | </dd> | |
663 | <dt> <strong>Pmw.timevalidator</strong>(<em>text</em>, <em>separator</em> = <strong>':'</strong>)</dt><dd> | |
664 | <p> | |
665 | Validator function for <a href="EntryField.html">Pmw.EntryField</a> <strong>time</strong> standard validator.</p> | |
666 | ||
667 | <p></p> | |
668 | ||
669 | ||
670 | </dd> | |
671 | <dt> <strong>Pmw.tracetk</strong>(<em>root</em> = <strong>None</strong>, <em>on</em> = <strong>1</strong>, <em>withStackTrace</em> = <strong>0</strong>, <em>file</em> = <strong>None</strong>)</dt><dd> | |
672 | <p> | |
673 | Print debugging trace of calls to, and callbacks from, the Tk | |
674 | interpreter associated with the <em>root</em> window . If <em>root</em> is | |
675 | <strong>None</strong>, use the Tkinter default root. If <em>on</em> is true, start | |
676 | tracing, otherwise stop tracing. If <em>withStackTrace</em> is true, | |
677 | print a python function call stacktrace after the trace for each | |
678 | call to Tk. If <em>file</em> is <strong>None</strong>, print to standard error, | |
679 | otherwise print to the file given by <em>file</em>.</p> | |
680 | ||
681 | <p> For each call to Tk, the Tk command and its options are printed as | |
682 | a python tuple, followed by the return value of the command (if | |
683 | not the empty string). For example:</p> | |
684 | ||
685 | <dl><dd><pre>python executed: | |
686 | button = Tkinter.Button() | |
687 | button.configure(text = 'Hi') | |
688 | ||
689 | tracetk output: | |
690 | CALL TK> 1: ('button', '.3662448') -> '.3662448' | |
691 | CALL TK> 1: ('.3662448', 'configure', '-text', 'Hi')</pre></dd></dl> | |
692 | ||
693 | <p> Some calls from python to Tk (such as <strong>update</strong>, <strong>tkwait</strong>, | |
694 | <strong>invoke</strong>, etc) result in the execution of callbacks from Tk to | |
695 | python. These python callbacks can then recursively call into Tk. | |
696 | When displayed by <strong>tracetk()</strong>, these recursive calls are indented | |
697 | proportionally to the depth of recursion. The depth is also | |
698 | printed as a leading number. The return value of a call to Tk | |
699 | which generated recursive calls is printed on a separate line at | |
700 | the end of the recursion. For example:</p> | |
701 | ||
702 | <dl><dd><pre>python executed: | |
703 | def callback(): | |
704 | button.configure(text = 'Bye') | |
705 | return 'Got me!' | |
706 | button = Tkinter.Button() | |
707 | button.configure(command = callback) | |
708 | button.invoke()</pre></dd></dl> | |
709 | ||
710 | <dl><dd><pre>tracetk output: | |
711 | CALL TK> 1: ('button', '.3587144') -> '.3587144' | |
712 | CALL TK> 1: ('.3587144', 'configure', '-command', '3638368callback') | |
713 | CALL TK> 1: ('.3587144', 'invoke') | |
714 | CALLBACK> 2: callback() | |
715 | CALL TK> 2: ('.3587144', 'configure', '-text', 'Bye') | |
716 | CALL RTN> 1: -> 'Got me!'</pre></dd></dl> | |
717 | ||
718 | <p> <strong>Pmw.initialise()</strong> must be called before <strong>tracetk()</strong> so that hooks | |
719 | are put into the Tkinter CallWrapper class to trace callbacks from | |
720 | Tk to python and also to handle recursive calls correctly.</p> | |
721 | ||
722 | <p></p> | |
723 | ||
724 | ||
725 | </dd> | |
726 | <dt> <strong>Pmw.version</strong>(<em>alpha</em> = <strong>0</strong>)</dt><dd> | |
727 | <p> | |
728 | If <em>alpha</em> is false, return the base version of Pmw being used | |
729 | for this session. If <code>Pmw.setversion()</code> has not been called, this | |
730 | will be the latest installed version of Pmw. If <em>alpha</em> is true, | |
731 | return the list of alpha versions of Pmw being used for this | |
732 | session, in search order. If <code>Pmw.setalphaversions()</code> has not | |
733 | been called, this will be the empty list.</p> | |
734 | ||
735 | <p></p> | |
736 | ||
737 | ||
738 | </dd> | |
739 | <dt> <strong>Pmw.ymdtojdn</strong>(<em>year</em>, <em>month</em>, <em>day</em>, <em>julian</em> = <strong>-1</strong>, <em>papal</em> = <strong>1</strong>)</dt><dd> | |
740 | <p> | |
741 | Return the Julian Day Number corresponding to <em>year</em>, <em>month</em> and | |
742 | <em>day</em>. See <code>jdntoymd()</code> for description of other arguments)</p> | |
743 | ||
744 | <p></p> | |
745 | ||
746 | ||
747 | </dd> | |
748 | </dl> | |
749 | ||
750 | <center><P ALIGN="CENTER"> | |
751 | <IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5> | |
752 | </p></center> | |
753 | ||
754 | ||
755 | <font size=-1> | |
756 | <center><P ALIGN="CENTER"> | |
757 | Pmw 1.2 - | |
758 | 5 Aug 2003 | |
759 | - <a href="index.html">Home</a> | |
760 | ||
761 | </p></center> | |
762 | </font> | |
763 | ||
764 | </body> | |
765 | </html> | |
766 |