Skip to main content

[wx]Python event programming framework

Project description


.. image::

.. image::

.. image::

``fsleyes-props`` is a library which is used by used by `FSLeyes
<>`_, and which allows you to:

- Listen for change to attributes on a python object,

- Automatically generate ``wxpython`` widgets which are bound
to attributes of a python object

- Automatically generate a command line interface to set
values of the attributes of a python object.

To do this, you just need to subclass the :class:`.HasProperties` class,
and add some :class:`.PropertyBase` types as class attributes.


All of the dependencies of ``fsleyes-props`` are listed in the
`requirements.txt <requirements.txt>`_ file. ``fsleyes-props`` can be used
without wxPython, but GUI functionality will not be available.


``fsleyes-props`` is documented using `sphinx
<http://>`_. You can build the API documentation by

python doc

The HTML documentation will be generated and saved in the ``doc/html/``

Example usage

.. code-block:: python

>>> import fsleyes_props as props
>>> class PropObj(props.HasProperties):
>>> myProperty = props.Boolean()
>>> myPropObj = PropObj()
>>> # Access the property value as a normal attribute:
>>> myPropObj.myProperty = True
>>> myPropObj.myProperty
>>> # access the props.Boolean instance:
>>> myPropObj.getProp('myProperty')
<props.prop.Boolean at 0x1045e2710>
>>> # access the underlying props.PropertyValue object
>>> # (there are caveats for List properties):
>>> myPropObj.getPropVal('myProperty')
<props.prop.PropertyValue instance at 0x1047ef518>
>>> # Receive notification of property value changes
>>> def myPropertyChanged(value, *args):
>>> print('New property value: {}'.format(value))
>>> myPropObj.addListener(
>>> 'myProperty', 'myListener', myPropertyChanged)
>>> myPropObj.myProperty = False
New property value: False
>>> # Remove a previously added listener
>>> myPropObj.removeListener('myListener')


If you would like to contribute to ``fsleyes-props``, take a look at the
``fslpy`` `contributing guide

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
fsleyes_props-1.6.3-py2.py3-none-any.whl (104.1 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jul 5, 2018
fsleyes-props-1.6.3.tar.gz (112.8 kB) Copy SHA256 hash SHA256 Source None Jul 5, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page