Ask Your Question
3

Frames in interacts

asked 2010-08-25 14:35:38 +0100

mhampton gravatar image

Is there a way to split the output of an interact into frames (html frames)? In particular I would like to be able to get the contents of a webpage (with urllib2 for example) and display it in a frame alongside other sorts of output.

edit retag flag offensive close merge delete

Comments

You can also try CSS frames.

ccanonc gravatar imageccanonc ( 2010-08-25 16:05:36 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
5

answered 2010-08-26 03:03:03 +0100

Mike Hansen gravatar image

It's easier to have the user's browser do the work if possible. I'm not sure what your specific use case is, but here is an interact which will load a page in a frame:

def iframe(url):
    html('<iframe src="%s" style="width: 100%%; height: 400px;"></iframe>'%(url))

@interact
def _(url='http://www.google.com'):
    iframe(url)
edit flag offensive delete link more

Comments

Very Nice!

William Stein gravatar imageWilliam Stein ( 2010-08-26 03:12:18 +0100 )edit

Thanks, that helps. What I'd really like to do is have some web content in one frame, and Sage stuff in the other (for example, a 2d or 3d plot). Using <frameset> and your example I can get two webpages side by side, but not the Sage output (unless its html friendly).

mhampton gravatar imagemhampton ( 2010-08-26 11:29:37 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2010-08-25 14:35:38 +0100

Seen: 491 times

Last updated: Aug 26 '10