Adjust the size of the labels of all the widgets to be equal, so that the body of each widget lines up vertically. This assumes that each widget is a megawidget with a label component in column 0 (ie, the labelpos option was set to 'w', 'wn' or 'ws'). If sticky is set to a combination of 'n', 's', 'e' and 'w', the label will be positioned within its cell accordingly. For example to make labels right justified, set sticky to 'e', 'ne' or 'se'.
Create a wrapper function which displays a busy cursor while executing command and return the wrapper. When the wrapper function is called, it first calls Pmw.showbusycursor(), then the command (passing any arguments to it), then Pmw.hidebusycursor(). The return value of command is returned from the wrapper.
If updateFunction is specified, it is called just before the call to Pmw.hidebusycursor(). This is intended to be the Tkinter update() method, in which case it will clear any events that may have occurred while command was executing. An example of this usage is in the ShowBusy 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.
Note that the Tkinter update() 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 ofen) in a loop which also contains a call to _tkinter.dooneevent(). If update() is called from dooneevent() and there is data to be read on the connection, then the filehandler will be called continuously, thus hanging the application.
Convert the date in text 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 the separator character. The integers must be in the order specified by format, which must be a combination of 'd', 'm' and 'y' in any order. These give the order of the day, month and year fields. Examples of valid input are:
'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
If the application's pivot year (default 50) is not None and the year specified in text 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 century value (default 2000). If it is more than the pivot year then it is incremented by the century value less 100.
The function Pmw.setyearpivot() can be used to change the default values for the application's pivot and century.
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.
Forward methods from one class to another.
This function adds methods to the class fromClass. The names of the methods added are the names of the methods of the class toClass (and its base classes) except those which are already defined by fromClass or are found in the exclude list. Special methods with one or more leading or trailing underscores are also excluded.
When one of the added methods is called, the method of the same name is called on an instance defined by toPart and the return value passed back. If toPart is a string, then it specifies the name of an attribute (not a component) of the fromClass object. The class of this attribute should be toClass. If toPart is not a string, it must be a function taking a fromClass object and returning a toClass object.
This function must be called outside of and after the definition of fromClass.
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'])
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.
Initialise Pmw. This performs several functions:
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 Pmw.showbusycursor() can create busy cursors for them.
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.
Modify Tkinter's CallWrapper class to improve the display of errors which occur in callbacks. The new CallWrapper class calls Pmw.displayerror() to display background errors. This behaviour can be modified by calling Pmw.reporterrorstofile().
Using the window given by root, set the WM_DELETE_WINDOW 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 Pmw.initialise(). 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.
Set the base font size for the application to size. This is used by Pmw.logicalfont() as the default size for fonts.
Set the Tk option database for root according to fontScheme. This changes the default fonts set by Tk. fontScheme may be one of
If root is None, 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 root.
If useTkOptionDb 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 useTkOptionDb is false, then options for newly created megawidgets will be initialised to default values.
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.
If alpha is not set, return the list of base versions of Pmw that are currently installed and available for use. If alpha is set, return the list of alpha versions.
If file is None, or if Pmw.reporterrorstofile() has not been called, future Tk background errors will be displayed in an error window (by calling Pmw.displayerror()). If file is not None, future Tk background errors will be written to the file. file may be any object with a write() method, such as sys.stderr.
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.
Set the version of Pmw to use for this session to version. If
Pmw.setversion() 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.
Set the pivot year and century for the application's date
processing. These values are used in the
method. The default values of pivot and century are 50 and
Block events to and display a busy cursor on all windows in this application that are in the state normal or iconic. If a window and its contents have just been created, update_idletasks() may have to be called before Pmw.showbusycursor(). Windows created or deiconified after calling Pmw.showbusycursor() will not be blocked. The busy cursor will only be displayed if the BLT extension to Tk is present.
Convert a string to a real number (like
character representing the decimal point is given by separator.
If alpha is not set, return the base version of Pmw being used
for this session. If
Pmw.setversion() has not been called, this
will be the latest installed version of Pmw. If alpha is set,
return the list of alpha versions of Pmw being used for this
session, in search order. If
Pmw.setalphaversions() has not
been called, this will be the empty list.
Home. Pmw 0.7 Maintainer email@example.com. 2 Jun 1998