gui¶
main¶
-
class
axopy.gui.main.
Container
[source]¶ Graphics container for tasks.
-
set_layout
(layout)[source]¶ Set the layout of the container.
Parameters: layout (QLayout) – Any QLayout is OK to add.
-
set_widget
(widget)[source]¶ Set the widget containing all graphical elements.
Parameters: widget (QWidget) – Any QWidget is OK to add. See also
axopy.gui.canvas()
- Canvas widget and canvas items that can be added to the container.
axopy.gui.graph()
- Plotting widgets that can be added to the container.
-
show
()[source]¶ Show the container in the active application.
This is not normally needed, unless you’re testing out a GUI and using
gui_check()
.
-
-
axopy.gui.main.
get_qtapp
()[source]¶ Get a QApplication instance running.
Returns the current
QApplication
instance if it exists and creates it otherwise.Examples
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 con.show() app.exec_()
-
axopy.gui.main.
gui_check
()[source]¶ 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.Note
Be sure to call
Container.show()
at the end to display the container.Examples
Minimal example
from axopy.gui.main import Container, gui_check with gui_check(): con = Container() con.show()
canvas¶
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 (https://doc.qt.io/Qt-5/qgraphicsview.html).
-
class
axopy.gui.canvas.
Circle
(diameter, color='#333333')[source]¶ Circular item.
The coordinates of this item correspond to the center of the circle.
Parameters:
-
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 aQGraphicsItemGroup
(a group of two lines).Parameters: -
color
¶ 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 theQGraphicsItem
with theqitem
attribute. Once you know what kind ofQGraphicsItem
is being wrapped, you can use the corresponding Qt documentation to make use of more complete functionality.-
qitem
¶ 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.
Type: QGraphicsItem
-
color
¶ Color of the item.
-
opacity
¶ Opacity of the item (between 0 and 1).
-
pos
¶ Both X and Y coordinates of the item in the canvas.
-
visible
¶ Visibility of the item.
-
x
¶ X coordinate of the item in the canvas.
-
y
¶ 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
¶ Color of the item.
-