I found this useful (at least as a stopgap measure while waiting for 
Trac#21267 <https://trac.sagemath.org/ticket/21267>, which may be not as 
easy as it seems...), and thought that documenting this might be useful to 
people wanting interactive displays in Sagemath Jupyter notebooks :

The ipywidgets <https://github.com/ipython/ipywidgets> python package can 
be installed in the Sage jupyter notebook. To enable installation "in the 
right place", the installation instructions 
should be modified as :

sage -pip install ipywidgets

echo "jupyter nbextension enable --py --sys-prefix widgetsnbextension" | sage 

if you use the Sage Jupyter notebook (the original installation instructions 
are enough if you have installed your Sage kernel
in the system's Jupyter notebook). The following code snippet is enough to use 
the package :

from __future__ import print_functionfrom ipywidgets import interact, 
interactive, fixedimport ipywidgets as widgets

And that's all... My limited testing seems to validate this (ab?)use of the 
package :

def showbeta(a,b):

Note that the ipywidget package has no way to use a lot of Sage data types. Any 
argument to them have to be cast to
native python data types (int, float, string).

Clunky, but damn useful, at least for pedagogic purposes...


Emmanuel Charpentier

You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to