2

I really like the interactive functionality of the new iPython notebook.

I often use it to replace plots, and make them more informative.

The problem is, that the output of these interactive cells is not stored in the notebook (for offline viewing).

When I shutdown and reopen the notebook, there is no preview for these cells (while there is for non-interactive cells). The same happens when previewing on github.

Is there a way to dó store the (static) output of interactive cells? I understand that the interactive cell will have to be run in order to be interactive, but I would like to store a snapshot of the cell. The exact parameters that are being used to execute the function do not matter too much for me (though it would be nice to be able to set them).

Example: running an interactive notebook: notebook-running

Example: after closing and reopening: notebook-reopened

I am using:

  • python 3.6.1
  • iPython 4.6.1
Tivaro
  • 177
  • 12

1 Answers1

0

Renew : Sorry for my bad comprehension, and what you want must be the following codes: Represent decoretor

def represent(**default_args):
    def _wrapper_func(func):
        print("See some examples here!")
        print(f"[Example] Default arguments :{default_args}")
        print(f">> {func.__name__}(**{default_args})")
        print(f">> {func(**default_args)}")
        def _setargs(*args, **kwargs):
            return func(*args, **kwargs)
        return _setargs
    return _wrapper_func

------------------------------The old answer-------------------------------

It seems that you just need some snapshot to show how you dealt with the codes before. The solution is easy, see the following picture I give out. Guide

Save it in some specific place and review it if you need, while you have forget the meanings of you once codes!

misakawa
  • 41
  • 1
  • 6
  • Hi thanks. I am not really looking for a snapshot of the entire notebook. I just want each cell to have a representative output (as is usually the case). This has more to do with other people using the notebook. They may not want to run each cell. – Tivaro Aug 29 '17 at 11:20
  • @Tivaro Ok, I will give you what you want at once. Just see my codes! – misakawa Aug 29 '17 at 12:24
  • The use of the f-strings looks kind of clever, but _what does it have to do with the `interact` widget?_ – alexis Oct 16 '17 at 19:50
  • He said that he would use the interact widget to give a intuitive preview to the people who're checking his works. – misakawa Oct 17 '17 at 11:22