control module

LavaVu python interface

Interactive HTML UI controls library These functions can be called from the ControlFactory provided on

  • lavavu.Viewer()

  • lavavu.Object()

  • lavavu.Properties()

Some work only on the viewer and some only to objects and some to both. Each will provide a control that allows modifying visualisation properties or executing commands interactively in an IPython notebook environment

Example

Create a Button control to execute a rotation command:

>>> lv = lavavu.Viewer()
>>> lv.control.Button('rotate x 1')

Create a Range control to adjust the pointsize property:

>>> lv = lavavu.Viewer()
>>> pts = lv.points()
>>> pts.control.Range('pointsize', range=[1, 10])

For convenience, controls to set visualisation properties can often be created by calling control directly with the property name This will create a control of the default type for for that property if one is defined, e.g.

>>> lv = lavavu.Viewer()
>>> pts = lv.points()
>>> pts.control('pointsize')

Module Summary

classes:

control.Button

A push button control to execute a defined command

control.Checkbox

A checkbox control for a boolean value

control.Colour

A colour picker for setting colour properties

control.ColourMapList

A colourmap list selector, populated by the default colour maps

control.ColourMaps

A colourmap list selector, populated by the available colour maps, combined with a colourmap editor for the selected colour map

control.Command

A generic input control for executing command strings

control.Divider

A divider element

control.DualRange

A set of two range slider controls for adjusting a minimum and maximum range

control.Entry

A generic input control for string values

control.File

A file picker control

control.Filter

A set of two range slider controls for adjusting a minimum and maximum filter range

control.Gradient

A colourmap editor

control.List

A list of predefined input values to set properties or run commands

control.Number

A basic numerical input control

control.Number2D

A set of two numeric controls for adjusting a 2D value

control.Number3D

A set of three numeric controls for adjusting a 3D value

control.ObjectList

A set of checkbox controls for controlling visibility of all visualisation objects

control.ObjectSelect

A list selector of all visualisation objects that can be used to choose the target of a set of controls

control.Panel

Creates a control panel with an interactive viewer window and a set of controls placed to the left with the viewer aligned to the right

control.Range

A slider control for a range of values

control.Range2D

A set of two range slider controls for adjusting a 2D value

control.Range3D

A set of three range slider controls for adjusting a 3D value

control.Rotation

A set of six buttons for adjusting a 3D rotation

control.Tabs

Creates a group of controls with tabs that can be shown or hidden

control.TimeStepper

A time step selection range control with up/down buttons

control.Window

Creates an interaction window with an image of the viewer frame and webgl controller for rotation/translation

Module Details

classes:

class Button(target, command, label=None)[source]

Bases: _Control

A push button control to execute a defined command

class Checkbox(target, property=None, command=None, value=None, label=None, index=None, readproperty=None)[source]

Bases: _Control

A checkbox control for a boolean value

class Colour(*args, **kwargs)[source]

Bases: _Control

A colour picker for setting colour properties

class ColourMapList(target, selection=None, *args, **kwargs)[source]

Bases: List

A colourmap list selector, populated by the default colour maps

class ColourMaps(target, *args, **kwargs)[source]

Bases: _MultiControl

A colourmap list selector, populated by the available colour maps, combined with a colourmap editor for the selected colour map

class Command(*args, **kwargs)[source]

Bases: _Control

A generic input control for executing command strings

class Divider(target, property=None, command=None, value=None, label=None, index=None, readproperty=None)[source]

Bases: _Control

A divider element

class DualRange(target, properties, values=[None, None], label=None, range=(0.0, 1.0), step=None)[source]

Bases: _MultiControl

A set of two range slider controls for adjusting a minimum and maximum range

Parameters:

range (list or tuple) – Min/max values for the range

class Entry(target, property=None, command=None, value=None, label=None, index=None, readproperty=None)[source]

Bases: _Control

A generic input control for string values

class File(command='file', directory=False, multiple=False, accept='', *args, **kwargs)[source]

Bases: _Control

A file picker control

Unfortunately there is no way to get the file path

class Filter(target, filteridx, label=None, range=None, step=None)[source]

Bases: DualRange

A set of two range slider controls for adjusting a minimum and maximum filter range

Parameters:

range (list or tuple) – Min/max values for the filter range

class Gradient(target, *args, **kwargs)[source]

Bases: _Control

A colourmap editor

class List(target, property=None, options=None, *args, **kwargs)[source]

Bases: _Control

A list of predefined input values to set properties or run commands

Parameters:

options (list) – List of the available value strings

class Number(target=None, property=None, command=None, value=None, label=None, index=None, step=None, readproperty=None)[source]

Bases: _Control

A basic numerical input control

class Number2D(target, property, label=None, step=None, *args, **kwargs)[source]

Bases: _MultiControl

A set of two numeric controls for adjusting a 2D value

class Number3D(target, property, label=None, step=None, *args, **kwargs)[source]

Bases: _MultiControl

A set of three numeric controls for adjusting a 3D value

class ObjectList(viewer, *args, **kwargs)[source]

Bases: _MultiControl

A set of checkbox controls for controlling visibility of all visualisation objects

class ObjectSelect(viewer, objects=None, *args, **kwargs)[source]

Bases: _Container

A list selector of all visualisation objects that can be used to choose the target of a set of controls

Parameters:

objects (list) – A list of objects to display, by default all available objects are added

html()[source]

Return the HTML code

class Panel(*args, **kwargs)[source]

Bases: Window

Creates a control panel with an interactive viewer window and a set of controls placed to the left with the viewer aligned to the right

class Range(target=None, property=None, command=None, value=None, label=None, index=None, range=None, step=None, readproperty=None)[source]

Bases: _Control

A slider control for a range of values

Parameters:

range (list or tuple) – Min/max values for the range

class Range2D(target, property, label=None, value=None, range=(0.0, 1.0), step=None, *args, **kwargs)[source]

Bases: _MultiControl

A set of two range slider controls for adjusting a 2D value

Parameters:

range (list or tuple) – Min/max values for the ranges

class Range3D(target, property, label=None, value=None, range=(0.0, 1.0), step=None, *args, **kwargs)[source]

Bases: _MultiControl

A set of three range slider controls for adjusting a 3D value

Parameters:

range (list or tuple) – Min/max values for the ranges

class Rotation(target, *args, **kwargs)[source]

Bases: _MultiControl

A set of six buttons for adjusting a 3D rotation

class Tabs(target, buttons=True)[source]

Bases: _Container

Creates a group of controls with tabs that can be shown or hidden

Parameters:

buttons (boolean) – Display the tab buttons for switching tabs

html()[source]

Return the HTML code

tab(label='')[source]

Add a new tab, any controls appending will appear in the new tab :param label: Label for the tab, if omitted will be blank :type label: str

class TimeStepper(viewer, *args, **kwargs)[source]

Bases: Range

A time step selection range control with up/down buttons

class Window(viewer, resolution=None, align='left', wrapper='', fullscreen=False)[source]

Bases: _Container

Creates an interaction window with an image of the viewer frame and webgl controller for rotation/translation

Parameters:
  • align (str) – Set to “left/right” to align viewer window, default is left. Set to None to skip.

  • wrapper (str) – Set the style of the wrapper div, default is empty string so wrapper is enabled with no custom style Set to None to disable wrapper

html()[source]

Return the HTML code