Skip to content

Commit

Permalink
Display return value in interact
Browse files Browse the repository at this point in the history
As discussed at the dev meeting on Tuesday, you need to write rather odd
functions for interact because it doesn't display the return value. No-
one at the time could think of a good reason why it shouldn't.

This will probably create some unexpected results for existing code, but
we've said widgets are unstable.
  • Loading branch information
takluyver committed Jun 26, 2015
1 parent b045f8c commit 68f771f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ipywidgets/widgets/interaction.py
Expand Up @@ -218,6 +218,7 @@ def call_f(name=None, old=None, new=None):
manual_button.disabled = True
try:
container.result = f(**container.kwargs)
display(container.result)
except Exception as e:
ip = get_ipython()
if ip is None:
Expand Down

7 comments on commit 68f771f

@flutefreak7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, previously I could make a function which produced a matplotlib plot based on some inputs, then use interact to create sliders which enabled a very smoothly updating plot while interacting with the sliders. Now because the return value is displayed (None in the simplest case), the plot flickers when updating (the cells below jump up to fill the space when the plot briefly disappears) creating a jarring experience that's no longer very responsive/interactive. It'd be nice if there were perhaps an option to disable output display or else somehow preserve the smoothness that existed before.

@jdfreder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takluyver maybe if the return value is None we should not trigger the display logic.

@ellisonbg
Copy link
Member

@ellisonbg ellisonbg commented on 68f771f Aug 18, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flutefreak7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also created Issue #145 with a lot more information (some examples/discussion of workarounds) about this... I'm a bit new to Github, so I apologize for bringing this up in multiple places.

@DavidPowell
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also raised this issue on the jupyter google group: https://groups.google.com/d/msg/jupyter/QTDkm4ZTbzE/_t1fEoVlAQAJ

This change has made interactive plots completely unusable.

@ellisonbg
Copy link
Member

@ellisonbg ellisonbg commented on 68f771f Aug 26, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdfreder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alope107 - you'll want to mark the PR you open as a resolution to #145 . You can do that by inserting the text closes #145 at the bottom of the PR's description. This will make it so the issue is automatically closed when your PR is merged.

Please sign in to comment.