pyOMA.GUI.HelpersGUI.MyMplCanvas#
- class pyOMA.GUI.HelpersGUI.MyMplCanvas(parent=None, width=5, height=2.5, dpi=100, figure=None)[source]#
Bases:
FigureCanvasQTAggEmbeddable Matplotlib canvas widget for PyQt6 GUIs.
A thin wrapper around
FigureCanvasQTAggthat creates a figure with a single axes and handles size-policy setup automatically. Also usable as a Designer “promoted widget” placeholder for an externally supplied figure (seeset_figure()) — Designer/uic can only ever instantiate this withparentat form-construction time, so a figure that doesn’t exist yet (e.g. one owned by a plot object passed in later) must be attached afterwards rather than through the constructor.- Parameters:
parent (QWidget, optional) – Parent widget.
width (float, optional) – Figure width in inches. Default is 5.
height (float, optional) – Figure height in inches. Default is 2.5.
dpi (int, optional) – Figure resolution in dots per inch. Default is 100.
figure (matplotlib.figure.Figure, optional) – Use this existing figure instead of creating a new one with its own axes. When given,
width/height/dpiare ignored andcompute_initial_figure()is not called.
Methods
__init__([parent, width, height, dpi, figure])acceptDrops(self)accessibleDescription(self)accessibleIdentifier(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blit([bbox])Blit the canvas in bbox (default entire canvas).
blockSignals(self, b)buffer_rgba()Get the image as a memoryview to the renderer's buffer.
changeEvent(self, a0)childAt(-> QWidget|None -> QWidget|None)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)compute_initial_figure()connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)copy_from_bbox(bbox)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)draw()Render the figure, and queue a request for a Qt draw.
drawRectangle(rect)draw_idle()Queue redraw of the Agg buffer and request Qt paintEvent.
dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)flush_events()Flush the GUI events for the figure.
focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)get_default_filename()Return a suitable default filename, including the extension.
get_default_filetype()Return the default savefig file format as specified in :rc:`savefig.format`.
get_renderer()get_supported_filetypes()Return dict of savefig file formats supported by this backend.
get_supported_filetypes_grouped()Return a dict of savefig file formats supported by this backend, where the keys are a file type name, such as 'Joint Photographic Experts Group', and the values are a list of filename extensions used for that filetype, such as ['jpg', 'jpeg'].
get_width_height(*[, physical])Return the figure width and height in integral points or pixels.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse()grabShortcut(self, key[, context])grab_mouse(ax)Set the child ~.axes.Axes which is grabbing the mouse events.
graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inaxes(xy)Return the topmost visible ~.axes.Axes containing the point xy.
inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQmlExposed(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)is_saving()Return whether the renderer is in the process of saving to a file, rather than rendering for an on-screen buffer.
keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseEventCoords([pos])Calculate mouse coordinates in physical pixels.
mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move()moveEvent(self, a0)moveToThread(self, thread)mpl_connect(s, func)Bind function func to event s.
mpl_disconnect(cid)Disconnect the callback with id cid.
nativeEvent(self, eventType, message)nativeParentWidget(self)new_manager(figure, num)Create a new figure manager for figure, using this canvas class.
new_timer([interval, callbacks])Create a new backend-specific subclass of .TimerBase.
nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Copy the image from the Agg canvas to the qt.drawable.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)print_avif(filename_or_obj, *[, metadata, ...])Write the figure to a AVIF file.
print_figure(*args, **kwargs)Render the figure to hardcopy.
print_gif(filename_or_obj, *[, metadata, ...])Write the figure to a GIF file.
print_jpeg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_jpg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_png(filename_or_obj, *[, metadata, ...])Write the figure to a PNG file.
print_raw(filename_or_obj, *[, metadata])print_rgba(filename_or_obj, *[, metadata])print_tif(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_tiff(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_to_buffer()print_webp(filename_or_obj, *[, metadata, ...])Write the figure to a WebP file.
property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)release_mouse(ax)Release the mouse grab held by the ~.axes.Axes ax.
removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint()resize()resizeEvent(self, a0)restoreGeometry(self, geometry)restore_region(region[, bbox, xy])saveGeometry(self)screen(self)scroll()sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleIdentifier(self, identifier)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize()setContentsMargins()setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize()setFixedWidth(self, w)setFocus()setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry()setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask()setMaximumHeight(self, maxh)setMaximumSize()setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize()setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent()setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement()setSizePolicy()setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_cursor(cursor)Set the current cursor.
set_figure(figure)Re-point this already-constructed canvas at a different figure.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])start_event_loop([timeout])Start a blocking event loop.
statusTip(self)stop_event_loop([event])Stop the current blocking event loop.
style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tostring_argb()Get the image as ARGB bytes.
tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update()updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)Attributes
button_pick_idbuttondcallbackscustomContextMenuRequestedint = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
destroyedint = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
device_pixel_ratioThe ratio of physical to logical pixels used for the canvas on screen.
eventsfiletypesfixed_dpiobjectNameChangedint = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
required_interactive_frameworkscroll_pick_idstaticMetaObjectsupports_blitwindowIconChangedint = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
windowIconTextChangedint = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
windowTitleChangedint = ..., arguments: Sequence = ...) -> PYQT_SIGNAL