cls_BaseObject - almarklein/visvis GitHub Wiki

The base class for wibjects and wobjects. Instances of classes inherited from this class represent something that can be drawn.

Wibjects and wobjects can have children and have a parent (which can be None in which case they are in orphan and never drawn). To change the structure, use the ".parent" property. They also can be set visible/invisible using the property ".visible".

The BaseObject class implements the following properties:
children, eventDoubleClick, eventEnter, eventKeyDown, eventKeyUp, eventLeave, eventMotion, eventMouseDown, eventMouseUp, eventScroll, hitTest, parent, visible

The BaseObject class implements the following methods:
Destroy, DestroyGl, Draw, FindObjects, GetFigure, GetWeakref, OnDestroy, OnDestroyGl, OnDraw, OnDrawFast, OnDrawScreen, OnDrawShape

Properties

Get a shallow copy of the list of children.

Fired when the mouse is double-clicked on this object.

Fired when the mouse enters this object or one of its children.

Fires when the mouse is moved over the object. Not fired when the mouse is over one of its children.

Fires when the mouse is moved over the object. Not fired when the mouse is over one of its children.

Fired when the mouse leaves this object (and is also not over any of it's children).

Fires when the mouse is moved over the object. Not fired when the mouse is over one of its children.

Fired when the mouse is pressed down on this object. (Also fired the first click of a double click.)

Fired when the mouse is released after having been clicked down on this object (even if the mouse is now not over the object). (Also fired on the first click of a double click.)

Fires when the scroll wheel is used while over the object. Not fired when the mouse is over one of its children.

Get/Set whether mouse events are generated for this object. From v1.7 this property is set automatically, and need not be set to receive mouse events.

Get/Set the parent of this object. Use this to change the tree structure of your visualization objects (for example move a line from one axes to another).

Get/Set whether the object should be drawn or not. If set to False, the hittest is also not performed.

Methods

Destroy the object. * Removes itself from the parent's children * Calls Destroy() on all its children * Calls OnDestroyGl and OnDestroy on itself

Note1: do not overload, overload OnDestroy(). Note2: it's best not to reuse destroyed objects. To temporary disable an object, better use "ob.parent=None", or "ob.visible=False".

Destroy the OpenGl objects managed by this object. * Calls DestroyGl() on all its children. * Calls OnDestroyGl() on itself.

Note: do not overload, overload OnDestroyGl().

For wibjects: calls Draw() on the figure that contains this object. For wobjects: calls Draw() on the axes that contains this object.

Find the objects in this objects' children, and its childrens children, etc, that correspond to the given pattern.

The pattern can be a class or tuple of classes, an attribute name (as a string) that the objects should have, or a callable that returns True or False given an object. For example 'lambda x: ininstance(x, cls)' will do the same as giving a class.

If 'self' is a wibject and has a _wobject property (like the Axes wibject) this method also performs the search in the list of wobjects.

Get the figure that this object is part of. The figure represents the OpenGL context. Returns None if it has no figure.

Get a weak reference to this object. Call the weakref to obtain the real reference (or None if it's dead).

Overload this to clean up any resources other than the GL objects.

Overload this to clean up any OpenGl resources.

Perform the opengl commands to draw this wibject/wobject. Objects should overload this method to draw themselves.

Overload this to provide a faster version to draw (but less pretty), which is called when the scene is zoomed/translated. By default, this calls OnDraw()

Draw in screen coordinates. To be used for wobjects that need drawing in screen coordinates (like text). Wibjects are always drawn in screen coordinates (using OnDraw).

Perform the opengl commands to draw the shape of the object in the given color. If not implemented, the object cannot be picked.

⚠️ **GitHub.com Fallback** ⚠️