class ViewBase

ViewBase is an abstract class providing common functionality for user-defined views. It provides facilities for associating the view with one or more Models, and some default behaviour for responding to changes in a model.

ViewBase is not intended to be used directly as a base class. Usable subclasses of ViewBase include View and GLView.


List of models being observed. Do not modify this list directly. Use the add_model and remove_model methods to attach and detach models.

Convenience property for when only one model is being observed. Reading this property returns models[0] when models is not empty, otherwise it returns None. Assigning a model to this property removes all other models and adds it as the sole model. Assigning None to this property removes all models.

The Cursor to display when the mouse is over the view, or None to use the default cursor.

To prevent any cursor from being shown over this view, set the cursor property to StdCursors.invisible.

Abstract methods 

Called when an attached model's notify_view method is called without specifying a message name. The default action is to call the view's invalidate method.

Called when an attached model is destroyed. The default action is to destroy the window containing this view, if any.

Note: The model parameter should only be used to identify which model is being destroyed, if the view is observing more than one model. Do not rely on the state of the model object that is being destroyed.


Attaches a model to this view, so that the view will be notified of changes to the model. This is an alternative to calling the model's add_view method.

Detaches a model from this view. This is an alternative to calling the model's remove_view method.
Called following the receipt of a mouse-down event, returns an iterator which yields a series of mouse-drag events as long as the mouse button is held down, followed by a mouse-up event. The positions of all events are reported in the view's local coordinate system. While the iterator is active, all mouse movement events are reported, whether they occur within the view's bounds or not, and any other user input events are ignored.