ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

ipywidget Output to text file

Open scottwsides opened this issue 2 years ago • 1 comments
trafficstars

Is there a way to capture ipywidget output and direct to a file? eg

nout = ipywidgets.Output()
with nout:
   print("hi there")

and instead of "hi there" going to the display... directing to a file? The 'print' is just an example. I want to capture 'warnings' coming from initializing complex objects to a file.

scottwsides avatar Sep 12 '23 19:09 scottwsides

Credit goes to @bollwyvl for looking at this during our triage call. You could use json.dumps(nout.outputs). There are a couple of things you could do in addition to the suggestion here - one of them would be to use the observe event handler to call some function whenever the outputs traitlet is changed.

ibdafna avatar Oct 10 '23 15:10 ibdafna