##// END OF EJS Templates
Merge pull request #998 from minrk/homedir...
Merge pull request #998 from minrk/homedir defer to stdlib os.path.expanduser('~') for path.get_home_dir() frozen env still comes first, and My Documents registry query is fallback on Windows, but in all normal cases, expanduser is used, which has $HOME as first priority. IPython also no longer considers finding no writable home dir as a fatal error. closes #810 closes #747 closes #970

File last commit:

r4872:34c10438
r5391:351c8fc4 merge
Show More
display.py
35 lines | 833 B | text/x-python | PythonLexer
"""Various display related classes.
Authors : MinRK
"""
class YouTubeVideo(object):
"""Class for embedding a YouTube Video in an IPython session, based on its video id.
e.g. to embed the video on this page:
http://www.youtube.com/watch?v=foo
you would do:
vid = YouTubeVideo("foo")
display(vid)
"""
def __init__(self, id, width=400, height=300):
self.id = id
self.width = width
self.height = height
def _repr_html_(self):
"""return YouTube embed iframe for this video id"""
return """
<iframe
width="%i"
height="%i"
src="http://www.youtube.com/embed/%s"
frameborder="0"
allowfullscreen
></iframe>
"""%(self.width, self.height, self.id)