class axopy.gui.main.Container[source]

Graphics container for tasks.


Set the layout of the container.

Parameters:layout (QLayout) – Any QLayout is OK to add.

Set the widget containing all graphical elements.

Parameters:widget (QWidget) – Any QWidget is OK to add.

See also

Canvas widget and canvas items that can be added to the container.
Plotting widgets that can be added to the container.

Show the container in the active application.

This is not normally needed, unless you’re testing out a GUI and using gui_check().


Get a QApplication instance running.

Returns the current QApplication instance if it exists and creates it otherwise.


This function is primarily for internal usage, but it is exposed to make it convenient to test graphical code without all of the experiment/task machinery.

from axopy.gui.main import get_qtapp, Container

# get the application instance first, before creating widgets etc.
app = get_qtapp()

con = Container()

# call show() to show the widget, then run the application

Check graphical interface code interactively.

This function makes it convenient to test graphical code without all of the experiment/task machinery. You can create a Container, add things to the container, and then call this function with the container to run the GUI and try it out.


Be sure to call at the end to display the container.


Minimal example

from axopy.gui.main import Container, gui_check

with gui_check():
    con = Container()


2D canvas style graphics functionality backed by Qt’s QGraphicsView.

class axopy.gui.canvas.Canvas(draw_border=True, bg_color=None, border_color=None, parent=None, invert_x=False, invert_y=False)[source]

A 2D canvas interface implemented using a QGraphicsView.

This view essentially just holds a QGraphicsScene that grows to fit the size of the view, keeping the aspect ratio square. The scene is displayed with a gray (by default) border.

See Qt’s documentation for more information about working with QGraphicsView (


Add an item to the canvas.

Parameters:item (Item or QGraphicsItem) – The item to add to the canvas. This can be either one of AxoPy’s built-in items (Circle, Text, etc.) or any QGraphicsItem.
resizeEvent(self, QResizeEvent)[source]
class axopy.gui.canvas.Circle(diameter, color='#333333')[source]

Circular item.

The coordinates of this item correspond to the center of the circle.

  • dia (float) – Diameter of the circle with respect to the scene coordinate system.
  • color (str) – Hex string to set the color of the circle. You can use the underlying qitem attribute to get the underlying QGraphicsEllipseItem to set stroke color vs. fill color, etc. if needed.
class axopy.gui.canvas.Cross(size=0.05, linewidth=0.01, color='#333333')[source]

Collection of two lines oriented as a “plus sign”.

The coordinates of this item correspond to the center of the cross. This item’s qitem attribute is a QGraphicsItemGroup (a group of two lines).

  • size (float) – The size is the length of each line making up the cross.
  • linewidth (float) – Thickness of each line making up the cross.
  • color (str) – Color of the lines making up the cross.

Color of the lines in the cross.

class axopy.gui.canvas.Item(qitem)[source]

Canvas item base class.

This is simply a wrapper around any kind of QGraphicsItem, adding the ability to set some properties of the underlying item with a more Pythonic API. You can always access the QGraphicsItem with the qitem attribute. Once you know what kind of QGraphicsItem is being wrapped, you can use the corresponding Qt documentation to make use of more complete functionality.


The QGraphicsItem being wrapped. You can use this attribute to access methods and properties of the item not exposed by the wrapper class. If you find yourself routinely using a method of the QGraphicsItem, consider recommending it for addition to AxoPy.


Determine if the item intersects with another item.


Color of the item.

get(prop, *args, **kwargs)[source]

Get any property of the underlying QGraphicsItem.


Set the item to invisible.


Opacity of the item (between 0 and 1).


Both X and Y coordinates of the item in the canvas.


Set any properties of the underlying QGraphicsItem.


Set the item to visible.


Visibility of the item.


X coordinate of the item in the canvas.


Y coordinate of the item in the canvas.

class axopy.gui.canvas.Line(x1, y1, x2, y2, width=0.01, color='#333333')[source]

Line item.


Color of the item.

class axopy.gui.canvas.Rectangle(width, height, x=0, y=0, color='#333333', penwidth=0.01)[source]

Rectangular item.

This is a filled retangle that allows you to set the size, color, position, etc. By default, the item’s position is its center.


Color of the rectangle.

class axopy.gui.canvas.Text(text, color='#333333')[source]

Text item.


Widgets for plotting multi-channel signals.

class axopy.gui.graph.SignalWidget[source]

Scrolling oscilloscope-like widget for displaying real-time signals.

Intended for multi-channel viewing, each channel gets its own row in the widget, and all channels share y-axis zoom.


Adds a window of data to the widget.

Previous windows are scrolled to the left, and the new data is added to the end.

Parameters:data (ndarray, shape = (n_channels, n_samples)) – Window of data to add to the end of the currently-shown data.