How to enable webview in Python. Is it possible?

Is it possible to enable webview in a Python instance?

Welcome to the forums @Nikilite!

Yes, it is possible to enable the webview in a Python repl, just make sure that your repl hosts a website, and you should be good to go!

1 Like

Thank you! I just don’t know how to do it because when I’m in my Python instance, there is no webview in the tools. If someone could provide me with a small tutorial, I would be happy. :slight_smile:

1 Like

Well if your Repl hosts a webpage (using Flask or the like), then it will detect the connection and when you hit “Run” at the top of your editor, it should open the webview.

If you closed out your webview by accident, clicking Run again should open it back up.

2 Likes
# Import flask to create a server
from flask import Flask

# Create app
app = Flask(__name__)


@app.route('/')
def index():
    return 'Hello!'


# If this file isn't being imported
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=81)
2 Likes

Thanks! It worked. (for people who may have made a mistake, it should be placed after the imports and not at the end)

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.