Tk interface for Param
ParamTk is an optional Tkinter interface to Param, allowing easy construction of GUIs from existing objects.
Starting with an existing parameterized object (http://ioam.github.com/param/):
>>> import param
>>> class A(param.Parameterized):
... a = param.Number(0.5,bounds=(0,1),doc="Probability that...")
... b = param.Boolean(default=True,doc="Whether to...")
...
>>> x = A()
If we start ParamTk and create a Tkinter window:
>>> import Tkinter, paramtk
>>> paramtk.initialize()
>>> window = Tkinter.Toplevel()
We can create a simple property sheet, allowing immediate editing of the instance's parameters:
>>> paramtk.ParametersFrame(window,x)
The original declaration of each parameter is automatically transformed to create a sensible GUI element (e.g. a numeric parameter with bounds is represented by a slider, while a boolean parameter is represented by a checkbox). The underlying object is automatically updated without the need for additional code.
Apart from creating a property sheet for a single object, ParamTk can also be used to display individual parameters from multiple objects in specific positions, allowing for the creation of flexible GUIs.
Note: While ParamTk is being used successfully, it was originally written as proof of concept and thus could be simplified considerably. Additionally, creating new interfaces to Param in alternative GUI toolkits should be straightforward. If you are interested, please contact us.
ParamTk depends on Tkinter (usually included as standard with Python), PIL with its Tk interface (http://www.pythonware.com/products/pil/), and Param (http://ioam.github.com/param/).
Official releases of ParamTk are available from PyPi, and can be installed along with dependencies via pip install --user paramtk
or easy_install paramtk
. More recent changes can be obtained by cloning the git repository.
Alternatively, after seperately installing the dependencies, ParamTk can be installed via python setup.py install
.
Comprehensive reference generated from the source code:
Reference Manual
Questions and comments are welcome at https://github.com/ioam/paramtk/issues.