| Trees | Indices | Help |
|
|---|
|
|
A Parameterized subclass that maintains Tkinter.Variable shadows (proxies) of its Parameters. The Tkinter Variable shadows are kept in sync with the Parameter values, and vice versa.
Optionally performs the same for an additional shadowed Parameterized (extraPO). The Parameters of the extra shadowed PO are available via this object (via both the usual 'dot' attribute access and dedicated parameter accessors declared in this class).
The Tkinter.Variable shadows for this Parameterized and any extra shadowed one are available under their corresponding parameter names in the _tkvars dictionary.
(See note 1 for complications arising from name clashes.)
Parameters being represented by TkParameterizedBase also have a 'translators' dictionary, allowing mapping between string representations of the objects and the objects themselves (for use with e.g. a Tkinter.OptionMenu). More information about the translators is available from specific translator-related methods in this class.
(a) There is an order of precedance for parameter lookup: this PO > shadowed PO.
Therefore, if you create a Parameter for this PO with the same name as one of the shadowed PO's Parameters, only the Parameter on this PO will be shadowed.
Example: 'name' is a common attribute. As a Parameterized, this object has a 'name' Parameter. Any shadowed PO will also have a 'name' Parameter. By default, this object's name will be shadowed at the expense of the name of the extra shadowed PO.
The precedence order can be reversed by setting the attribute 'self_first' on this object to False.
(b) Along the same lines, an additional complication can arise relating specifically to 'dot' attribute lookup. For instance, a sublass of TkParameterized might also inherit from Tkinter.Frame. Frame has many of its own attributes, including - for example - 'size'. If we shadow a Parameterized that has a 'size' Parameter, the Parameterized's size Parameter will not be available as .size because ('dot') attribute lookup begins on the local object and is not overridden by 'self_first'. Using the parameter accessors .get_parameter_object('size') or .get_parameter_value('size') (and the equivalent set versions) avoids this problem.
If a shadowed PO's Parameter value is modified elsewhere, the Tkinter Variable shadow is NOT updated until that Parameter value or shadow value is requested from this object. Thus requesting the value will always return an up-to-date result, but any GUI display of the Variable might display a stale value (until a GUI refresh takes place).
|
|||
|
Inherited from |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
_extraPO = None
|
|||
name = <param.parameterized.String object at 0xa9cb06c>String identifier for this object. |
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
|
|
Translation between displayed values and objectsA Parameter has a value, but that might need some processing to become a value suitable for display. For instance, the SheetMask() object <SheetMask SheetMask0001923> ... Important attributes
Determines precedence order for Parameter lookup: if True, Parameters of this object take priority whenever there is a name clash; if False, Parameters of extraPO take priority.
(Note that in the various dictionaries above, the entry for Parameter serves as a default, since keys are looked up by class, so any Parameter type not specifically listed will be covered by the Parameter entry.)
|
Add _tkvars[name] to represent the parameter object with the specified name. The appropriate Variable is used for each Parameter type. Also adds tracing mechanism to keep the Variable and Parameter values in sync, and updates the translator dictionary to map string representations to the objects themselves. |
Return the value of the tk variable representing param_name. (Before returning the variable's value, ensures it's up to date.) |
Attempt to set the parameter represented by param_name to the value of its corresponding Tkinter Variable. If setting the parameter fails (e.g. an inappropriate value is set for that Parameter type), the Variable is reverted to its previous value. (Called by the Tkinter Variable's trace_variable() method.) |
Return a list of Parameterizeds in which to find Parameters. The list is ordered by precedence, as defined by self_first. |
Return the Parameter object (not value) specified by name, from the source_POs in this object (or the specified parameterized_object). If with_source=True, returns also the source parameterizedobject. |
Return the value of the parameter specified by name. If a parameterized_object is specified, looks for the parameter there. Otherwise, looks in the source_POs of this object. |
Set the value of the parameter specified by name to val. Updates the corresponding tkvar. |
|
|
Change the given string for the named parameter into an object. If there is a translator for param_name, translate the string to the object; otherwise, call convert_string2obj on the string. |
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Thu Aug 5 14:59:28 2010 | http://epydoc.sourceforge.net |