chaco.examples.demo.advanced.scalar_image_function_inspector module

Colormap of a scalar value field with cross sections that can be animated

A complex example showing interaction between a Traits-based interactive model, interactive plot parameters, and multiple Chaco components.

Renders a colormapped image of a scalar value field, and a cross section chosen by a line interactor.

Animation must be disabled (unchecked) before the model can be edited.

class chaco.examples.demo.advanced.scalar_image_function_inspector.DemoModelView

Bases: traits.has_traits.HasTraits

configure_traits(*args, **kws)

Creates and displays a dialog box for editing values of trait attributes, as if it were a complete, self-contained GUI application.

This method is intended for use in applications that do not normally have a GUI. Control does not resume in the calling application until the user closes the dialog box.

The method attempts to open and unpickle the contents of filename before displaying the dialog box. When editing is complete, the method attempts to pickle the updated contents of the object back to filename. If the file referenced by filename does not exist, the object is not modified before displaying the dialog box. If filename is unspecified or None, no pickling or unpickling occurs.

If edit is True (the default), a dialog box for editing the current object is displayed. If edit is False or None, no dialog box is displayed. You can use edit=False if you want the object to be restored from the contents of filename, without being modified by the user.

Parameters
  • filename (str) –

    The name (including path) of a file that contains a pickled representation of the current object. When this parameter is specified, the method reads the corresponding file (if it exists) to restore the saved values of the object’s traits before displaying them. If the user confirms the dialog box (by clicking OK), the new values are written to the file. If this parameter is not specified, the values are loaded from the in-memory object, and are not persisted when the dialog box is closed.

    Deprecated since version 6.0.0.

  • view (View or str) – A View object (or its name) that defines a user interface for editing trait attribute values of the current object. If the view is defined as an attribute on this class, use the name of the attribute. Otherwise, use a reference to the view object. If this attribute is not specified, the View object returned by trait_view() is used.

  • kind (str) – The type of user interface window to create. See the traitsui.view.kind_trait trait for values and their meanings. If kind is unspecified or None, the kind attribute of the View object is used.

  • edit (bool) –

    Indicates whether to display a user interface. If filename specifies an existing file, setting edit to False loads the saved values from that file into the object without requiring user interaction.

    Deprecated since version 6.2.0.

  • context (object or dictionary) – A single object or a dictionary of string/object pairs, whose trait attributes are to be edited. If not specified, the current object is used

  • handler (Handler) – A handler object used for event handling in the dialog box. If None, the default handler for Traits UI is used.

  • id (str) – A unique ID for persisting preferences about this user interface, such as size and position. If not specified, no user preferences are saved.

  • scrollable (bool) – Indicates whether the dialog box should be scrollable. When set to True, scroll bars appear on the dialog box if it is not large enough to display all of the items in the view at one time.

Returns

Return type

True on success.

edit_traits(*args, **kws)

Displays a user interface window for editing trait attribute values.

Parameters
  • view (View or string) – A View object (or its name) that defines a user interface for editing trait attribute values of the current object. If the view is defined as an attribute on this class, use the name of the attribute. Otherwise, use a reference to the view object. If this attribute is not specified, the View object returned by trait_view() is used.

  • parent (toolkit control) – The reference to a user interface component to use as the parent window for the object’s UI window.

  • kind (str) – The type of user interface window to create. See the traitsui.view.kind_trait trait for values and their meanings. If kind is unspecified or None, the kind attribute of the View object is used.

  • context (object or dictionary) – A single object or a dictionary of string/object pairs, whose trait attributes are to be edited. If not specified, the current object is used.

  • handler (Handler) – A handler object used for event handling in the dialog box. If None, the default handler for Traits UI is used.

  • id (str) – A unique ID for persisting preferences about this user interface, such as size and position. If not specified, no user preferences are saved.

  • scrollable (bool) – Indicates whether the dialog box should be scrollable. When set to True, scroll bars appear on the dialog box if it is not large enough to display all of the items in the view at one time.

Returns

Return type

A UI object.

update_view(event)
class chaco.examples.demo.advanced.scalar_image_function_inspector.Model(*args, **kwargs)

Bases: traits.has_traits.HasTraits

compute_model()
class chaco.examples.demo.advanced.scalar_image_function_inspector.PlotUI(*args, **kwargs)

Bases: traits.has_traits.HasTraits

create_plot()
update(model)
class chaco.examples.demo.advanced.scalar_image_function_inspector.TimerController

Bases: traits.has_traits.HasTraits

motions = ((1, 1), (1, 2), (1, 3), (2, 1), (3, 1), (3, 2), (2, 3), (1, -1), (1, -2), (1, -3), (2, -1), (3, -1), (3, -2), (2, -2))
onTimer(*args)

Callback function which responds to each timer tick and animates the moving selection point and colors.