dpapadopoulos
dpapadopoulos

Reputation: 1846

Q: How can I create dynamically an iframe inside a web content using Python?

I am trying to create an iframe inside a web content (no matter where exactly need to be inserted). The only way that I need to do this, is just by making it dynamically and also by using Python3+ version. The iframe's information is not important either. Id, class name and more can be random or custom. It is not necessary to insert specific data. Also, I don't need an answer about the height and the width. I already have solved it.

What do I mean dynamically? I mean that if someone clicks on a button then I need to insert this iframe. If someone clicks on another button then I need to delete it, and so on.

Upvotes: 2

Views: 1192

Answers (2)

roy jeens
roy jeens

Reputation: 36

Check my code below:

def function(given_from_user_url):
    """return the iframe result"""
    from IPython.display import IFrame
    return IFrame(url, width='50%', height=350) 

This function is returning an instance of an iframe with width equals with the 50% of the page and a height of 350 pixels. Then the result of this function you can use it was you want in your rest project. Is this what you are looking for?

Upvotes: 2

balderman
balderman

Reputation: 23815

Sounds like HTML / Javascript challenge. Why do you think it is related to python?

Upvotes: 0

Related Questions