Skip to content

Commit 2b4b0c8

Browse files
committed
PLOT: separate animation widgets from image to preserve image size [MPY-313]
1 parent 12642d0 commit 2b4b0c8

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

metview/bindings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,12 +1172,13 @@ def animate(*args, **kwargs):
11721172

11731173
widgets.jslink((play_widget, "value"), (frame_widget, "value"))
11741174
play_and_speed_widget = widgets.HBox([play_widget, speed_widget])
1175-
controls = widgets.VBox([image_widget, frame_widget, play_and_speed_widget])
1175+
controls = widgets.VBox([frame_widget, play_and_speed_widget])
11761176

11771177
controls.layout.visibility = "hidden"
1178+
image_widget.layout.visibility = "hidden"
11781179
waitl_widget = widgets.Label(value="Generating plots....")
11791180
frame_widget.layout.width = "800px"
1180-
display(controls, waitl_widget)
1181+
display(image_widget, controls, waitl_widget)
11811182

11821183
# plot all frames to a temporary directory owned by Metview to enure cleanup
11831184
tempdirpath = tempfile.mkdtemp(dir=os.environ.get("METVIEW_TMPDIR", None))
@@ -1220,6 +1221,7 @@ def on_speed_change(change):
12201221
# and reveal the plot and the frame slider
12211222
waitl_widget.layout.visibility = "hidden"
12221223
controls.layout.visibility = "visible"
1224+
image_widget.layout.visibility = "visible"
12231225

12241226

12251227
# On a test system, importing IPython took approx 0.5 seconds, so to avoid that hit

0 commit comments

Comments
 (0)