neu_draw.toolbar¶
Buttons above a rendered view in a notebook, as ipywidgets.
The buttons: Center the camera on what is visible, Reset to the opening view, Refresh after editing the scene in a cell, Save a viewpoint and Restore it, go to where the Last closed figure was, Capture a PNG, SVG or PDF, Animate an orbit, and Close the figure, leaving its last image in place of the canvas. Capture and Animate read collapsible options panels.
Save/Restore and Last are separate slots on purpose (“the angle I chose” against “where I
was”). View.close writes the last slot, so re-running a cell and pressing Last, or
show(scene, viewpoint="last"), brings the angle back.
The buttons sit outside the canvas, so they are not part of the rendered image; the
legend is drawn inside it (neu_draw.backends.legend). The capture path is
pre-filled as <prefix>_<timestamp>.png, the prefix being the last one used.
Attributes¶
Classes¶
The button bar and the canvas, as one widget. |
Functions¶
|
A |
|
The pre-filled path, |
|
Record |
Module Contents¶
- class neu_draw.toolbar.Toolbar(view: Any, *, path: str | None = None)¶
The button bar and the canvas, as one widget.
viewis anything withcanvas,center(),save_view(),restore_view(),save(),snapshot(),logical_size()andclose(), so this module needs no pygfx. RaisesTypeErrorif the canvas is not an ipywidget (an offscreen or desktop canvas).- animation¶
- options¶
- path¶
- sliders¶
- status¶
- view¶
- widget¶
- neu_draw.toolbar.attach(view: Any, *, required: bool = True) Toolbar | None¶
A
Toolbarforview, orNonewhen one cannot exist.With
required=False(toolbar="auto"), missing ipywidgets or a canvas that is not a widget returnsNone; otherwise it raises.
- neu_draw.toolbar.default_path(prefix: str | None = None) str¶
The pre-filled path,
<prefix>_<timestamp>.png(or the last extension used).
- neu_draw.toolbar.remember_prefix(path: str) str¶
Record
path’s stem as the next default, dropping a trailing timestamp so they do not accumulate.
- neu_draw.toolbar.DEFAULT_PREFIX = 'snapshot'¶
- neu_draw.toolbar.FORMATS¶
- neu_draw.toolbar.TS_FORMAT = '%Y-%m-%d_%H-%M-%S'¶
- neu_draw.toolbar.last_prefix: str | None = None¶
- neu_draw.toolbar.last_suffix: str = '.png'¶