Added forms to select subject or course

This commit is contained in:
Jonathan Herrewijnen 2022-09-30 18:45:45 +02:00
parent 3f0c355578
commit 21faffb150
5 changed files with 32 additions and 34 deletions

Binary file not shown.

Binary file not shown.

35
main.py
View File

@ -3,7 +3,7 @@
import random
from io import BytesIO
import base64
from flask import Flask, make_response, request
from flask import Flask, make_response, request, render_template
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import plots
@ -11,27 +11,18 @@ import plots
app = Flask(__name__)
@app.route('/')
def plot_figure():
return plots.plot()
def my_form():
return render_template('index.html')
@app.route('/', methods=['POST'])
def my_form_post():
text = request.form['text']
processed_text = text.upper()
return processed_text
# @app.route('/')
# def plot_figure():
# return plots.plot()
if __name__ == '__main__':
app.run(debug=True, port=5002)
# from flaskapp import *
# from plots import Cijferlijst
# import matplotlib.pyplot as plt
# from datetime import datetime
# import matplotlib.dates as mdates
# if __name__ == "__main__":
# cf = Cijferlijst()
# data = cf.GetSubjectByYear("godsdienst", "2010/2011")
# #Get dates and convert them to actual dates
# x = data['Datum invoer(Voortgangsdossier)']
# x = [datetime.strptime(date, "%d-%m-%Y") for date in x]
# y = data['Cijfer(Voortgangsdossier)']
# y = [float(line.replace(",", ".")) for line in y]
# RunWeb()

View File

@ -7,7 +7,9 @@ from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import base64
app = Flask(__name__)
# app = Flask(__name__)
GRADE_LIST = "Cijfers-HerrewijnenJonathan.csv"
print(GRADE_LIST)
def plot():
# Generate the figure **without using pyplot**.
@ -25,7 +27,6 @@ def plot():
# import pandas as pd
# import numpy as np
# GRADE_LIST = "Cijfers-HerrewijnenJonathan.csv"
# class Cijferlijst:
# def __init__(self, grade_list=GRADE_LIST):

View File

@ -1,12 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css">
<script>"jquery-3.6.0.min.js"</script>
</head>
<body>
<h1>{{title}}</h1>
<img src="/" alt="img_data" id="imgplot"/>
</body>
<head>
<link rel="stylesheet" href="style.css">
<script>"jquery-3.6.0.min.js"</script>
</head>
<form method="POST">
<input name="text">
<input type="submit">
</form>
<body>
<h1>{{title}}</h1>
<img src="/" alt="img_data" id="imgplot" />
</body>
</html>