fsleyes.actions.screenshot

This module provides the ScreenshotAction class, an Action which can take screenshots of CanvasPanel and PlotPanel views.

A few stand-alone functions are defined in this module:

screenshot

Capture a screenshot of the contents of the given CanvasPanel, PlotPanel, or PlotCanvas, saving it to the given filename.

plotPanelScreenshot

Capture a screenshot of the contents of the given PlotPanel or PlotPanel, saving it to the given filename.

canvasPanelScreenshot

Capture a screenshot of the contents of the given CanvasPanel or PlotPanel, saving it to the given filename.

class fsleyes.actions.screenshot.ScreenshotAction(overlayList, displayCtx, panel)[source]

Bases: fsleyes.actions.base.Action

The ScreenshotAction is able to save a screenshot of the contents of CanvasPanel and PlotPanel views.

__init__(overlayList, displayCtx, panel)[source]

Create a ScreenshotAction.

Parameters
__doScreenshot()

Capture a screenshot. Prompts the user to select a file to save the screenshot to, and then calls the screenshot() function.

__annotations__ = {}
__module__ = 'fsleyes.actions.screenshot'
fsleyes.actions.screenshot.screenshot(panel, filename)[source]

Capture a screenshot of the contents of the given CanvasPanel, PlotPanel, or PlotCanvas, saving it to the given filename.

fsleyes.actions.screenshot.plotPanelScreenshot(panel, filename)[source]

Capture a screenshot of the contents of the given PlotPanel or PlotPanel, saving it to the given filename.

fsleyes.actions.screenshot.canvasPanelScreenshot(panel, filename)[source]

Capture a screenshot of the contents of the given CanvasPanel or PlotPanel, saving it to the given filename.

fsleyes.actions.screenshot._patchInCanvases(canvasPanel, containerPanel, data, bgColour)[source]

Used by the canvasPanelScreenshot() function.

For some unknown reason, under OSX and when running over X11/SSH, the contents of wx.glcanvas.GLCanvas instances are not captured by the WindowDC/MemoryDC blitting process performed by the canvasPanelScreenshot function - they come out all black.

So this function manually patches in bitmaps (read from the GL front buffer) of each GLCanvas that is displayed in the canvas panel.