Commit a57a71fc authored by htyao's avatar htyao
Browse files

Add function show()

parent 0db6d234
...@@ -4,6 +4,7 @@ import abc ...@@ -4,6 +4,7 @@ import abc
from string import ascii_lowercase, ascii_uppercase from string import ascii_lowercase, ascii_uppercase
from colour import Color from colour import Color
import subprocess import subprocess
from tempfile import NamedTemporaryFile
from deprecated import deprecated from deprecated import deprecated
from IPython.display import Image, display, SVG from IPython.display import Image, display, SVG
...@@ -243,6 +244,12 @@ class BasicDraw(VarnaConfig): ...@@ -243,6 +244,12 @@ class BasicDraw(VarnaConfig):
elif output[-3:] == 'svg': elif output[-3:] == 'svg':
display(SVG(filename=output)) display(SVG(filename=output))
def show(self, extension='png'):
"""Show the drawing
Equivalent to `savefig(tmp, show=True)` where tmp is a temporary file
"""
tmp = NamedTemporaryFile(suffix='.'+extension)
self.savefig(tmp.name, show=True)
class Structure(BasicDraw): class Structure(BasicDraw):
def __init__(self, sequence=None, structure=None): def __init__(self, sequence=None, structure=None):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment