| Trees | Indices | Help |
|
|---|
|
|
Classes linking Parameters to Tkinter.
TkParameterized allows flexible graphical representation and manipulation of the parameters of a Parameterized instance or class.
ParametersFrame and ParametersFrameWithApply extend TkParameterized, displaying all the Parameters together in a list. Both allow these Parameters to be edited; ParametersFrame applies changes immediately as they are made, whereas ParametersFrameWithApply makes no changes until a confirmation is given (by pressing the 'Apply' button).
Using these classes to display parameters has several benefits, including that, automatically:
You want to display all parameters of a parameterized instance inside an existing containter (e.g. a window or a frame):
# existing Parameterized instance g from topo import pattern g = pattern.Gaussian()
# existing window t import Tkinter t = Tkinter.Toplevel()
# display all the parameters of g in t from topo.param.tk import ParametersFrame ParametersFrame(t,g) #should be ParametersFrame(t,g).pack(); see ALERT in ParametersFrame
You want a new window displaying only the parameters of your object:
# existing Parameterized instance g from topo import pattern g = pattern.Gaussian()
# display all the parameters of g in a new window from topo.param.tk import edit_parameters edit_parameters(g)
You want to display only some of the parameters of one or more Parameterized instances:
## Existing, non-GUI code from topo import param
- class Object1(param.Parameterized):
- duration = param.Number(2.0,bounds=(0,None),doc='Duration of measurement') displacement = param.Number(0.0,bounds=(-1,1),doc='Displacement from point A')
- class Object2(param.Parameterized):
- active_today = param.Boolean(True,doc='Whether or not to count today') operator_name = param.String('A. Person',doc='Operator today')
o1 = Object1() o2 = Object2()
## Existing window import Tkinter t = Tkinter.Toplevel()
## Flexible GUI representation: display o1.duration, o1.displacement, ## and o2.active_today inside t, ignoring o2.operator_name from topo.param.tk import TkParameterized
t1 = TkParameterized(t,o1) t2 = TkParameterized(t,o2)
t1.pack_param('duration',side='left') t1.pack_param('displacement',side='bottom') t2.pack_param('active_today',side='right')
TkParameterized is itself a subclass of Parameterized, so a TkParameterized class can have its own parameters (in addition to representing those of an external parameterized instance or class).
## Existing class from topo import params
- class X(param.Parameterized):
- one = param.Boolean(True) two = param.Boolean(True)
## Panel to represent an instance of X from Tkinter import Frame from topo.param.tk import TkParameterized
class XPanel(TkParameterized,Frame):
dock = param.Boolean(False,doc='Whether to attach this Panel')
- def __init__(self,master,x):
- self.pack_param('dock',side='top',on_set=self.handle_dock) self.pack_param('one',side='left') self.pack_param('two',side='right')
- def handle_dock(self):
- if self.dock:
- # dock the window
- else:
- # undock the window
## Running the code t = Tkinter.Toplevel() x = X() XPanel(t,x)
$Id: tk.py 11264 2010-07-21 18:12:49Z ceball $
|
|||
| ScrodgetWidget | |||
| Scrodget | |||
|
Button A GUI-specific parameter to display a button. |
|||
|
TkParameterizedBase A Parameterized subclass that maintains Tkinter.Variable shadows (proxies) of its Parameters. |
|||
|
TkParameterized Provide widgets for Parameters of itself and up to one additional Parameterized instance or class. |
|||
| HackFileEntry | |||
|
Translator Abstract class that |
|||
|
DoNothingTranslator Performs no translation. |
|||
| BoolTranslator | |||
| ListTranslator | |||
|
Eval_ReprTranslator Translates a string to an object by eval()ing the string in __main__.__dict__ (i.e. |
|||
| String_ObjectTranslator | |||
| CSPTranslator | |||
|
ParametersFrame Displays and allows instantaneous editing of the Parameters of a supplied Parameterized. |
|||
|
ParametersFrameWithApply Displays and allows editing of the Parameters of a supplied Parameterized. |
|||
| Balloon | |||
|
Menu Tkinter Menu, but with a way to access entries by name. |
|||
|
TaggedSlider Widget for manipulating a numeric value using either a slider or a text-entry box, keeping the two values in sync. |
|||
|
FocusTakingButton A Tkinter Button that takes the focus when the mouse <Enter>s. |
|||
|
ScrolledFrame XXXX |
|||
| ScrolledWindow | |||
| ProgressController | |||
|
ProgressWindow Graphically displays progress information for a SomeTimer object. |
|||
|
ToolTip Provides a ToolTip widget for Tkinter. |
|||
| StatusBar | |||
|
AppWindow A ScrolledWindow with extra features intended to be common to all windows of an application. |
|||
| ListWidget | |||
| Representer | |||
| ListRepresenter | |||
| EditingParametersFrameWithApply | |||
| ListItemCtrlWidget | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
_last_one_set = None
|
|||
externaltk_path =
|
|||
root = None
|
|||
__package__ =
|
|||
|
|||
Return the inverse of dictionary dict_. (I.e. return a dictionary with keys that are the values of dict_, and values that are the corresponding keys from dict_.) The values of dict_ must be unique. |
Look for class_ or its superclasses in the keys of dict_; on finding a match, return the value (return None if no match found). Searches from the most immediate class to the most distant (i.e. from class_ to the final superclass of class_). |
Return the keys of d, sorted by value. The values of d must be unique (see inverse) |
|
|
Edit the Parameters of a supplied parameterized instance or class. Specify with_apply=False for a ParametersFrame (which immediately updates the object - no need to press the Apply button). Extra params are passed to the ParametersFrame constructor. |
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Thu Aug 5 14:59:19 2010 | http://epydoc.sourceforge.net |