The vispy.scene.widgets namespace provides a range of widgets to allow user interaction. Widgets are rectangular Visual objects such as buttons and sliders.
vispy.scene.widgets.
AxisWidget
Bases: vispy.scene.widgets.widget.Widget
vispy.scene.widgets.widget.Widget
Widget containing an axis
Orientation of the axis, ‘left’ or ‘bottom’.
Keyword arguments to pass to AxisVisual.
link_view
Link this axis to a ViewBox
This makes it so that the axis’s domain always matches the visible range in the ViewBox.
The ViewBox to link.
on_resize
Resize event handler
The event.
ColorBarWidget
Widget containing a ColorBar
Either the name of the ColorMap to be used from the standard set of names (refer to vispy.color.get_colormap), or a custom ColorMap object. The ColorMap is used to apply a gradient on the colorbar.
The orientation of the colorbar, used for rendering. The orientation can be thought of as the position of the label relative to the color bar.
When the orientation is ‘left’ or ‘right’, the colorbar is vertically placed. When it is ‘top’ or ‘bottom’, the colorbar is horizontally placed. The colorbar automatically resizes when its container’s dimension changes.
‘top’: the colorbar is horizontal. Color is applied from left to right. Minimum corresponds to left and maximum to right. Label is to the top of the colorbar ‘bottom’: Same as top, except that label is to the bottom of the colorbar ‘left’: the colorbar is vertical. Color is applied from bottom to top. Minimum corresponds to bottom and maximum to top. Label is to the left of the colorbar ‘right’: Same as left, except that the label is placed to the right of the colorbar
‘top’: the colorbar is horizontal. Color is applied from left to right. Minimum corresponds to left and maximum to right. Label is to the top of the colorbar
‘bottom’: Same as top, except that label is to the bottom of the colorbar
‘left’: the colorbar is vertical. Color is applied from bottom to top. Minimum corresponds to bottom and maximum to top. Label is to the left of the colorbar
‘right’: Same as left, except that the label is placed to the right of the colorbar
The label that is to be drawn with the colorbar that provides information about the colorbar.
The color of labels. This can either be a str as the color’s name or an actual instace of a vipy.color.Color
the minimum and maximum values of the data that is given to the colorbar. This is used to draw the scale on the side of the colorbar.
The width of the border the colormap should have. This measurement is given in pixels
The color of the border of the colormap. This can either be a str as the color’s name or an actual instace of a vipy.color.Color
padding with respect to the major and minor axis
ratio of minor axis to major axis
border_color
The color of the border around the ColorBar in pixels
border_width
The width of the border around the ColorBar in pixels
clim
cmap
label
orientation
ticks
Console
Fast and failsafe text console
Color to use.
Point size to use.
clear
Clear the console
font_size
The font size (in points) of the text
text_color
The color of the text
write
Write text and scroll
Text to write. '' can be used for a blank line, as a newline is automatically added to the end of each line.
''
If True, long messages will be wrapped to span multiple lines.
Grid
Widget that automatically sets the position and size of child Widgets to proportionally divide its internal area into a grid.
Spacing between widgets.
Keyword arguments to pass to Widget.
add_grid
Create a new Grid and add it as a child widget.
The row in which to add the widget (0 is the topmost row)
The column in which to add the widget (0 is the leftmost column)
The number of rows to be occupied by this widget. Default is 1.
The number of columns to be occupied by this widget. Default is 1.
Keyword arguments to pass to the new Grid.
add_view
Create a new ViewBox and add it as a child widget.
Keyword arguments to pass to ViewBox.
add_widget
Add a new widget to this grid. This will cause other widgets in the grid to be resized to make room for the new widget. Can be used to replace a widget as well
The Widget to add. New widget is constructed if widget is None.
parameters sent to the new Widget that is constructed if widget is None
Notes
The widget’s parent is automatically set to this grid, and all other parent(s) are removed.
grid_size
layout_array
next_row
remove_widget
Remove a widget from this grid
The Widget to remove
resize_widget
Resize a widget in the grid to new dimensions.
The widget to resize
The number of rows to be occupied by this widget.
The number of columns to be occupied by this widget.
Label
Label widget
The label.
The rotation of the label.
Keyword arguments to pass to TextVisual.
text
ViewBox
Provides a rectangular widget to which its subscene is rendered.
Three classes work together when using a ViewBox: * The SubScene class describes a “world” coordinate system and the entities that live inside it. * ViewBox is a “window” through which we view the subscene. Multiple ViewBoxes may view the same subscene. * Camera describes both the perspective from which the subscene is rendered, and the way user interaction affects that perspective.
SubScene
Camera
In general it is only necessary to create the ViewBox; a SubScene and Camera will be generated automatically.
The camera through which to view the SubScene. If None, then a PanZoomCamera (2D interaction) is used. If str, then the string is used as the argument to make_camera().
make_camera()
Extra keyword arguments to pass to Widget.
add
Add an Node to the scene for this ViewBox.
This is a convenience method equivalent to node.parent = viewbox.scene
The node to add.
camera
Get/set the Camera in use by this ViewBox
If a string is given (e.g. ‘panzoom’, ‘turntable’, ‘fly’). A corresponding camera is selected if it already exists in the scene, otherwise a new camera is created.
The camera object is made a child of the scene (if it is not already in the scene).
Multiple cameras can exist in one scene, although only one can be active at a time. A single camera can be used by multiple viewboxes at the same time.
get_scene_bounds
Get the total bounds based on the visuals present in the scene
Dimension to return.
If dim is None, Returns a list of 3 tuples, otherwise the bounds for the requested dimension.
dim is None
is_in_scene
Get whether the given node is inside the scene of this viewbox.
The node.
scene
The root node of the scene viewed by this ViewBox.
Widget
Bases: vispy.scene.visuals.Compound
vispy.scene.visuals.Compound
A widget takes up a rectangular space, intended for use in a 2D pixel coordinate frame.
The widget is positioned using the transform attribute (as any node), and its extent (size) is kept as a separate property.
A 2-element tuple to specify the top left corner of the widget.
A 2-element tuple to spicify the size of the widget.
The color of the border.
The width of the border line in pixels.
The background color.
The amount of padding in the widget (i.e. the space reserved between the contents and the border).
The margin to keep outside the widget’s border.
All arguments are given to Grid().
All arguments are given to ViewBox().
Add a Widget as a managed child of this Widget.
The child will be automatically positioned and sized to fill the entire space inside this Widget (unless _update_child_widgets is redefined).
The widget to add.
The widget.
bgcolor
The background color of the Widget.
height
The actual height of the widget
height_max
The maximum height of the widget
height_min
The minimum height of the widget
inner_rect
The rectangular area inside the margin, border, and padding.
Generally widgets should avoid drawing or placing sub-widgets outside this rectangle.
margin
padding
picking
Boolean that determines whether this node (and its children) are drawn in picking mode.
pos
rect
Remove a Widget as a managed child of this Widget.
The widget to remove.
size
The size (w, h) of this widget.
If the widget is a child of another widget, then its size is assigned automatically by its parent.
stretch
Stretch factors (w, h) used when determining how much space to allocate to this widget in a layout.
If either stretch factor is None, then it will be assigned when the widget is added to a layout based on the number of columns or rows it occupies.
width
The actual width of this widget
width_max
The maximum width the widget can have
width_min
The minimum width the widget can have