Skip to content

Instantly share code, notes, and snippets.

@rpmuller
Last active January 23, 2019 05:53
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rpmuller/5666810 to your computer and use it in GitHub Desktop.
Save rpmuller/5666810 to your computer and use it in GitHub Desktop.
IPython's SVG display functionality, in conjunction with the ease of making SVG strings using ElementTrees, makes it really easy to have a nice drawing canvas inside of IPython.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Carreau
Copy link

Carreau commented Jun 5, 2013

may I suggest adding a _repr_svg_ to Scene ?

@rpmuller
Copy link
Author

@Carreau - great idea. Done!

@ohlr
Copy link

ohlr commented Nov 20, 2018

To get it working with Jupyter + Python 3.6 I had to do the following:
return "#%x%x%x" % (int(rgb[0]/16),int(rgb[1]/16),int(rgb[2]/16))
SVG(scene.to_svg())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment