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 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
|
<html>
<head>
<title>Pmw functions reference manual</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ee"
vlink="551a8b" alink="ff0000">
<center><P ALIGN="CENTER">
<IMG SRC = transdove.gif ALT = "" WIDTH=70 HEIGHT=75>
<IMG SRC = transdove.gif ALT = "" WIDTH=70 HEIGHT=75>
<IMG SRC = transdove.gif ALT = "" WIDTH=70 HEIGHT=75>
</p></center>
<h1 ALIGN="CENTER">Pmw functions</h1>
<p>
<dl>
<dt> <strong>Pmw.aboutcontact</strong>(<em>value</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.aboutcopyright</strong>(<em>value</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.aboutversion</strong>(<em>value</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.aligngrouptags</strong>(<em>groups</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.alignlabels</strong>(<em>widgets</em>, <em>sticky</em> = <strong>None</strong>)<dd>
<p>
Adjust the size of the labels of all the <em>widgets</em> to be equal, so
that the body of each widget lines up vertically. This assumes
that each widget is a megawidget with a <em>label</em> component in
column 0 (ie, the <strong>labelpos</strong> option was set to <strong>'w'</strong>, <strong>'wn'</strong> or
<strong>'ws'</strong>). If <em>sticky</em> is set to a combination of <strong>'n'</strong>, <strong>'s'</strong>,
<strong>'e'</strong> and <strong>'w'</strong>, the label will be positioned within its cell
accordingly. For example to make labels right justified, set
<em>sticky</em> to <strong>'e'</strong>, <strong>'ne'</strong> or <strong>'se'</strong>.</p>
<p></p>
</dt>
<dt> <strong>Pmw.busycallback</strong>(<em>command</em>, <em>updateFunction</em> = <strong>None</strong>)<dd>
<p>
Create a wrapper function which displays a busy cursor while
executing <em>command</em> and return the wrapper. When the wrapper
function is called, it first calls <strong>Pmw.showbusycursor()</strong>, then
the <em>command</em> (passing any arguments to it), then <strong>Pmw.hidebusycursor()</strong>.
The return value of <em>command</em> is returned from the wrapper.</p>
<p> If <em>updateFunction</em> is specified, it is called just before the
call to <strong>Pmw.hidebusycursor()</strong>. This is intended to be the
Tkinter <strong>update()</strong> method, in which case it will clear any events
that may have occurred while <em>command</em> was executing. An example
of this usage is in the <strong>ShowBusy</strong> demonstration: run the
demonstration, click on the entry widget then click on the button
and type some characters while the busy cursor is displayed. No
characters should appear in the entry widget.</p>
<p> Note that the Tkinter <strong>update()</strong> method should only be called when
it is known that it can be safely called. One case where a
problem has been found is when a filehandler has been created (on
a non-blocking Oracle database connection), but the filehandler
does not read from the connection. The connection is read (by a
call to the Oracle fetch function <em>ofen</em>) in a loop which also
contains a call to <strong>_tkinter.dooneevent()</strong>. If <strong>update()</strong> is
called from <strong>dooneevent()</strong> and there is data to be read on the
connection, then the filehandler will be called continuously, thus
hanging the application.</p>
<p></p>
</dt>
<dt> <strong>Pmw.clearbusycursor</strong>()<dd>
<p></p>
</dt>
<dt> <strong>Pmw.datestringtojdn</strong>(<em>text</em>, <em>format</em>)<dd>
<p>
Convert the date in <em>text</em> into the corresponding Julian Day
Number, which is defined to be the number of days since 1 Jan 4713
BC. The date must be specified as three integers separated by <strong>/</strong>
characters. The integers must be in the order specified by
<em>format</em>, which must be one of <strong>dmy</strong>, <strong>mdy</strong> or <strong>ymd</strong>, giving the
order of the day, month and year fields. Examples of valid input
are:</p>
<dl><dd><pre> 'dmy': 31/01/99 31/1/1999 31/1/99
'mdy': 01/31/99 1/31/1999 1/31/99
'ymd': 99/01/31 1999/1/31 99/1/31</pre></dl>
<p> If the application's
<em>pivot</em> year (default 50) is not <strong>None</strong> and the year specified
in <em>text</em> has only one or two digits, then the year is
converted to a four digit year. If it is less than or equal to
the pivot year, then it is incremented by the application's
<em>century</em> value (default 2000). If it is more than the pivot year
then it is incremented by the <em>century</em> value less 100.</p>
<p> The function <strong>Pmw.setyearpivot()</strong> can be used to change the
default values for the application's
<em>pivot</em> and <em>century</em>.</p>
<p></p>
</dt>
<dt> <strong>Pmw.displayerror</strong>(<em>text</em>)<dd>
<p>
This is a general purpose method for displaying background errors
to the user. The errors would normally be programming errors and
may be caused by errors in Tk callbacks or functions called by other
asynchronous events. The error messages are shown in a text window.
If further errors occur while the window is displayed, the window
is raised and these new errors are queued. The queued errors may
be viewed by the user or ignored by dismissing the window.</p>
<p></p>
</dt>
<dt> <strong>Pmw.fontexists</strong>(<em>widget</em>, <em>fontName</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.forwardmethods</strong>(<em>fromClass</em>, <em>toClass</em>, <em>toPart</em>, <em>exclude</em> = <strong>[]</strong>)<dd>
<p>
Forward methods from one class to another.</p>
<p> This function adds methods to the class <em>fromClass</em>. The names of
the methods added are the names of the methods of the class
<em>toClass</em> (and its base classes) except those which are already
defined by <em>fromClass</em> or are found in the <em>exclude</em> list.
Special methods with one or more leading or trailing underscores
are also excluded.</p>
<p> When one of the added methods is called, the method of the same
name is called on an instance defined by <em>toPart</em> and the return
value passed back. If <em>toPart</em> is a string, then it specifies the
name of an attribute (<em>not</em> a component) of the <em>fromClass</em>
object. The class of this attribute should be <em>toClass</em>. If
<em>toPart</em> is not a string, it must be a function taking a
<em>fromClass</em> object and returning a <em>toClass</em> object.</p>
<p> This function must be called outside of and after the definition
of <em>fromClass</em>.</p>
<p> For example:</p>
<dl><dd><pre>class MyClass:
def __init__(self):
...
self.__target = TargetClass()
...
def foo(self):
pass
def findtarget(self):
return self.__target
Pmw.forwardmethods(MyClass, TargetClass, '__target',
['dangerous1', 'dangerous2'])
# ...or...
Pmw.forwardmethods(MyClass, TargetClass, MyClass.findtarget,
['dangerous1', 'dangerous2'])</pre></dl>
<p> In both cases, all TargetClass methods will be forwarded from
MyClass except for dangerous1, dangerous2, special methods like
__str__, and pre-existing methods like foo.</p>
<p></p>
</dt>
<dt> <strong>Pmw.hidebusycursor</strong>()<dd>
<p></p>
</dt>
<dt> <strong>Pmw.hulltomegawidget</strong>(<em>tkWidget</em>)<dd>
<p></p>
</dt>
<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>)<dd>
<p>
Initialise Pmw. This performs several functions:</p>
<ul><li><p>Set up a trap in the Tkinter Toplevel constructor so that a
list of Toplevels can be maintained. A list of all Toplevel
windows needs to be kept so that <strong>Pmw.showbusycursor()</strong> can
create busy cursors for them.</p>
<li><p>Set up a trap in the Tkinter Toplevel and Frame destructors
so that Pmw is notified when these widgets are destroyed.
This allows Pmw to destroy megawidgets when their hull
widget is destroyed and to prune the list of Toplevels.</p>
<li><p>Modify Tkinter's CallWrapper class to improve the display of
errors which occur in callbacks. The new CallWrapper class
calls <strong>Pmw.displayerror()</strong> to display background errors.
This behaviour can be modified by calling
<strong>Pmw.reporterrorstofile()</strong>.</p>
<li><p>Using the window given by <em>root</em>, set the <strong>WM_DELETE_WINDOW</strong>
root window protocol to destroy the root window. This means
that the root window is destroyed if the window manager
deletes it. This is only done if the protocol has not been
set before the call to <strong>Pmw.initialise()</strong>. This protocol is
required if there is a modal dialog displayed and the window
manager deletes the root window. Otherwise the application
will not exit, even though there are no windows.</p>
<li><p>Set the base font size for the application to <em>size</em>. This
is used by <strong>Pmw.logicalfont()</strong> as the default size for
fonts.</p>
<li><p>Set the Tk option database for <em>root</em> according to
<em>fontScheme</em>. This changes the default fonts set by Tk.
<em>fontScheme</em> may be one of</p>
<dl><dt><strong>None</strong> <dd>Do not change the Tk defaults.</p>
<dt><strong>'pmw1'</strong> <dd>Set the default font to be Helvetica with bold italic
menus and italic scales.</p>
</dl>
<li><p>If <em>root</em> is <strong>None</strong>, use the Tkinter default root window as the
root, if it has been created, or create a new Tk root window.
The function returns this <em>root</em>.</p>
<li><p>If <em>useTkOptionDb</em> is true, then, when a megawidget is
created, the Tk option database will be queried to get the
initial values of the options which have not been set in
the call to the constructor. The resource name used in the
query is the same as the option name and the resource class
is the option name with the first letter capitalised. If
<em>useTkOptionDb</em> is false, then options for newly created
megawidgets will be initialised to default values.</p>
</ul>
<p> It is not absolutely necessary to call this function to be able to use
Pmw. However, some functionality will be lost. Most importantly,
Pmw megawidgets will not be notified when their hull widget is
destroyed. This may prevent the megawidget from cleaning up
timers which will try to access the widget, hence causing a
background error to occur.</p>
<p></p>
</dt>
<dt> <strong>Pmw.installedversions</strong>(<em>alpha</em> = <strong>0</strong>)<dd>
<p>
If <em>alpha</em> is not set, return the list of base versions of Pmw
that are currently installed and available for use. If <em>alpha</em> is
set, return the list of alpha versions.</p>
<p></p>
</dt>
<dt> <strong>Pmw.jdntoymd</strong>(<em>jdn</em>, <em>julian</em> = <strong>-1</strong>, <em>papal</em> = <strong>1</strong>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.logicalfont</strong>(<em>name</em> = <strong>'Helvetica'</strong>, <em>sizeIncr</em> = <strong>0</strong>, **<em>kw</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.logicalfontnames</strong>()<dd>
<p></p>
</dt>
<dt> <strong>Pmw.maxfontwidth</strong>(<em>widget</em>, <em>fontName</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.reporterrorstofile</strong>(<em>file</em> = <strong>None</strong>)<dd>
<p>
If <em>file</em> is <strong>None</strong>, or if <strong>Pmw.reporterrorstofile()</strong> has not been
called, future Tk background errors will be displayed in an error
window (by calling <strong>Pmw.displayerror()</strong>). If <em>file</em> is not
<strong>None</strong>, future Tk background errors will be written to the file.
<em>file</em> may be any object with a <strong>write()</strong> method, such as
<strong>sys.stderr</strong>.</p>
<p></p>
</dt>
<dt> <strong>Pmw.setalphaversions</strong>(*<em>alpha_versions</em>)<dd>
<p>
Set the list of alpha versions of Pmw to use for this session to
the arguments. When searching for Pmw classes and functions,
these alpha versions will be searched, in the order given, before
the base version. This must be called before any other Pmw class
or function, except functions setting or querying versions.</p>
<p></p>
</dt>
<dt> <strong>Pmw.setversion</strong>(<em>version</em>)<dd>
<p>
Set the version of Pmw to use for this session to <em>version</em>. If
<code>Pmw.setversion()</code> is not called, the latest installed version of
Pmw will be used. This must be called before any other Pmw class
or function, except functions setting or querying versions.</p>
<p></p>
</dt>
<dt> <strong>Pmw.setyearpivot</strong>(<em>pivot</em>, <em>century</em> = <strong>None</strong>)<dd>
<p>
Set the pivot year and century for the application's date
processing. These values are used in the <code>datestringtojdn()</code>
method. The default values of <em>pivot</em> and <em>century</em> are <strong>50</strong> and
<strong>2000</strong> repectively.</p>
<p></p>
</dt>
<dt> <strong>Pmw.showbusycursor</strong>()<dd>
<p>
Block events to and display a busy cursor on all windows in this
application that are in the state <em>normal</em> or <em>iconic</em>. If a
window and its contents have just been created, <strong>update_idletasks()</strong>
may have to be called before <strong>Pmw.showbusycursor()</strong>. Windows created or
deiconified after calling <strong>Pmw.showbusycursor()</strong> will not be blocked.
The busy cursor will only be displayed if the BLT extension to Tk
is present.</p>
<p></p>
</dt>
<dt> <strong>Pmw.timestringtoseconds</strong>(<em>text</em>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.tracetk</strong>(<em>root</em>, <em>on</em>, <em>withStackTrace</em> = <strong>0</strong>, <em>file</em> = <strong>None</strong>)<dd>
<p></p>
</dt>
<dt> <strong>Pmw.version</strong>(<em>alpha</em> = <strong>0</strong>)<dd>
<p>
If <em>alpha</em> is not set, return the base version of Pmw being used
for this session. If <code>Pmw.setversion()</code> has not been called, this
will be the latest installed version of Pmw. If <em>alpha</em> is set,
return the list of alpha versions of Pmw being used for this
session, in search order. If <code>Pmw.setalphaversions()</code> has not
been called, this will be the empty list.</p>
<p></p>
</dt>
<dt> <strong>Pmw.ymdtojdn</strong>(<em>y</em>, <em>m</em>, <em>d</em>, <em>julian</em> = <strong>-1</strong>, <em>papal</em> = <strong>1</strong>)<dd>
<p></p>
</dt>
</dl>
<center><P ALIGN="CENTER">
<IMG SRC = blue_line.gif ALT = "" WIDTH=320 HEIGHT=5>
</p></center>
<font size=-1>
<center><P ALIGN="CENTER">
<a href="index.html">Home</a>.
Pmw 0.6.2
Maintainer
<a href="mailto:gregm@iname.com">gregm@iname.com</a>.
23 Feb 1998
</p></center>
</font>
</body>
</html>
|