-
-
Save Hammer2900/418edef7ee556c65c7d3214e6fbac97b to your computer and use it in GitHub Desktop.
PyWebView Flask Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
import webview | |
import sys | |
import threading | |
app = Flask(__name__) | |
@app.route('/') | |
def hello_world(): | |
return 'Hello World!' | |
def start_server(): | |
app.run(host='0.0.0.0', port=80) | |
if __name__ == '__main__': | |
t = threading.Thread(target=start_server) | |
t.daemon = True | |
t.start() | |
webview.create_window("PyWebView & Flask", "http://localhost/") | |
webview.start() | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment