class test(object): def __init__(self): pass def __repr__(self): "Lowest in the display order" txt = "2 + 2 = 4" return txt # def _repr_png_(self): # "Higher than text in the display order" # with open("PNG_doc.resized.png",'rb') as f: # txt = f.read() # return txt # def _repr_svg_(self): # "Higher then text in the display order" # txt = """ # # """ # return txt # def _repr_latex_(self): # "Second highest in the display order" # txt = "$$x^2 = 4$$" # return txt # def _repr_html_(self): # "Highest in the display order" # txt = "What?" # return txt T = test() T # In order to make this executable on any other computer, I need to grab a # remote png file. from urllib.request import urlretrieve urlretrieve("http://i.imgur.com/aTxezXX.png", "PNG_doc.resized.png") class test(object): def __init__(self): pass def __repr__(self): "Lowest in the display order" txt = "2 + 2 = 4" return txt def _repr_png_(self): "Higher than text in the display order" with open("PNG_doc.resized.png",'rb') as f: txt = f.read() return txt # def _repr_svg_(self): # "Higher then text in the display order" # txt = """ # # """ # return txt # def _repr_latex_(self): # "Second highest in the display order" # txt = "$$x^2 = 4$$" # return txt # def _repr_html_(self): # "Highest in the display order" # txt = "What?" # return txt T = test() T class test(object): def __init__(self): pass def __repr__(self): "Lowest in the display order" txt = "2 + 2 = 4" return txt def _repr_png_(self): "Higher than text in the display order" with open("PNG_doc.resized.png",'rb') as f: txt = f.read() return txt def _repr_svg_(self): "Higher then text in the display order" txt = """ """ return txt # def _repr_latex_(self): # "Second highest in the display order" # txt = "$$x^2 = 4$$" # return txt # def _repr_html_(self): # "Highest in the display order" # txt = "What?" # return txt T = test() T class test(object): def __init__(self): pass def __repr__(self): "Lowest in the display order" txt = "2 + 2 = 4" return txt def _repr_png_(self): "Higher than text in the display order" with open("PNG_doc.resized.png",'rb') as f: txt = f.read() return txt def _repr_svg_(self): "Higher then text in the display order" txt = """ """ return txt def _repr_latex_(self): "Second highest in the display order" txt = r"$$x^2 = \frac{16}{4}$$" return txt # def _repr_html_(self): # "Highest in the display order" # txt = "What?" # return txt T = test() T class test(object): def __init__(self): pass def __repr__(self): "Lowest in the display order" txt = "2 + 2 = 4" return txt def _repr_png_(self): "Higher than text in the display order" with open("PNG_doc.resized.png",'rb') as f: txt = f.read() return txt def _repr_svg_(self): "Higher then text in the display order" txt = """ """ return txt def _repr_latex_(self): "Second highest in the display order" txt = "$$x^2 = 4$$" return txt def _repr_html_(self): "Highest in the display order" txt = ('What? .... ' 'HTML is really the tops!') return txt T = test() T from IPython.display import display_svg display_svg(T)