Skip to content

Commit

Permalink
Core: Add no_toolbar option to CueFigure (#56)
Browse files Browse the repository at this point in the history
The figure widget has toolbar that is now by default disabled in the
CueFigure.
  • Loading branch information
agoscinski authored Jul 6, 2024
1 parent e480910 commit 2cb8e81
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/scwidgets/cue/_widget_cue_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class CueFigure(CueOutput):
Specify `traitlets.All` to observe all traits.
:param cued:
Specifies if it is cued on initialization
:param no_toolbars:
Hide toolbars and headers when using widget mode
:param css_syle:
- **base**: the css style of the box during initialization
- **cue**: the css style that is added when :param
Expand All @@ -48,6 +50,7 @@ def __init__(
None, str, List[str], List[List[str]], Sentinel
] = None,
cued: bool = True,
no_toolbars: bool = True,
css_style: Optional[dict] = None,
**kwargs,
):
Expand Down Expand Up @@ -77,6 +80,14 @@ def __init__(
raise NotImplementedError(
f"matplotlib backend " f"{matplotlib.backends.backend!r} not supported."
)

if no_toolbars:
# hides unnecessary elements shown with %matplotlib widget
self.figure.canvas.header_visible = False
self.figure.canvas.footer_visible = False
self.figure.canvas.toolbar_visible = False
self.figure.canvas.resizable = False

self.draw_display()

def clear_display(self, wait=False):
Expand Down

0 comments on commit 2cb8e81

Please sign in to comment.