I have a Python program that's designed to allow the user to select points on an image. The points that are clicked are saved to a YML file.
I currently have it set up in a way where, when the Python program is called from the server, it executes the Python GUI in a separate window (as it would if you executed it through the command line) and the user input is taken through the command line I used to run the server. I'd like this to all be internal. As in, everything runs through the server if that makes sense.
How would I go about doing this? Is there a library available that makes something like this possible? The code belows shows how the Python program is currently run within the server. If you go the the /test url, it executes in this case.
Hopefully this image will give you an idea of what I'm trying to do. Essentially, I need to image to be open AND interact-able in the server. I don't need the exact code to do this, just an explanation of how I should go about doing it.
- project
- data (folder that holds output information from pythonGUI.py)
- app
- templates
- index.html
- routes.py
- models.py
- __init__.py
- pythonGUI.py
- config.py
- server.py
routes.py
from app import app
from flask import Flask, request, render_template, session
import pythonGUI
app.secret_key = app.config['SECRET_KEY']
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/test')
def test():
return pythonGUI.main()
if __name__ == '__main__':
app.run(host='0.0.0.0', port='8000', debug=True)
pythonGUI.py
from app import app
import cv2
def main():
#Some code here
if __name__ == '__main__':
main()
If you need more code, please let me know. I'm not sure what would be relevant to show in this case. Thank you