This test is made in html, but you can change it just with python and tkinter as graphic user interface. This is the output of the test in html.
This is the GUI made with python and tkinter
The code for the template in html
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Your first HTML form</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script> </head> <body> <!-- traccia --> <h3> Calcola il 22% su 10.500 € </h3> <form action="mailto:aziendaitalia@gmail.com?subject='Esercizio 1'" method="post"> <label for="msg">Risposta:</label> <br> <textarea id="msg" name="Risposta" class="form-control" rows="7" placeholder=" Inserire qui la risposta" > </textarea> <br> <button type="submit" class="btn btn-primary">Invia la risposta al prof.</button> </ul> </form> </body> </html>
The code for the tkinter GUI
import tkinter as tk import os def mktest(event="") -> str: ''' get the template and save a file substituting what you wrote ''' with open("oq.html", "r", encoding="utf-8") as file: file = file.read() html = file.replace("Calcola il 22% su 10.500 €", question.get("0.0", tk.END)) html = html.replace("aziendaitalia@gmail.com", email.get()) html = html.replace("Esercizio 1", question.get("0.0", tk.END)) with open("newfile.html", "w", encoding="utf-8") as file: file.write(html) os.startfile("newfile.html") # aziendaitalia@gmail.com root = tk.Tk() root.geometry("600x400") label = tk.Label(root, text="Enter your exercize or question:") label.pack() button = tk.Button(root, text="create the test") button.pack() button["command"] = mktest label2 = tk.Label(root, text="Enter your email (where the students will send the answer:") label2.pack() email = tk.Entry(root, bg="cyan", font="Arial 20") email.pack() question = tk.Text(root, bg="cyan", font="Arial 20") question.pack() root.mainloop()
The video tutorial about the code in python
Twitter: @pythonprogrammi - python_pygame