Hello, coding Replers,
So during the day, I had a very cool idea of a workaround for image drawing with PHP ( since I didn’t have the knowledge of it ) and it is joining the good ol’ friens turtle
and Flask! I thought this would be a very cool and easy project, but when I ran the idea, no errors! It only showed a VNC container with a blank computer and the secondary tabs being only the console, but when I tried to visit https://turtle.rixthetyrunt.repl.co/progress/?height=1&percent=100 it should show me a small progress bar-like thing, but guess what? A blue-black screen with blue binoculars… You can guess it, it’s the old friend “Hmm… We couldn’t reach this Repl” screen! So, why is it like that and making me not show a progress bar no matter what? Take some code:
EDIT: It isn’t creating any Postscript files nor .PNG images too
Repl link: turtle - Nix (beta) Repl - Replit
from turtle import *
from flask import *
from PIL import Image
app = Flask("turtle")
sc = Screen()
sc.getcanvas().winfo_toplevel().withdraw()
@app.route("/progress/")
def progressBar():
t = Turtle()
t.speed(0)
try:
sc.screensize(int(request.args["height"]) + 2, 102)
except:
if not "height" in request.args or not request.args["height"].isdigit():
abort(400)
sc.bgcolor("Black")
t.color("White")
t.penup()
t.goto(1, 1)
t.pendown()
t.goto(101, 1)
t.goto(1, 1)
t.color("#42d46d")
try:
t.goto(int(request.args["percent"]))
except:
if not "percent" in request.args or not request.args["percent"].isdigit():
abort(400)
t.getscreen().getcanvas().postscript(file="temp.ps")
Image.open("temp.ps").save("temp", "png")
return send_from_directory(".", "temp.png")
app.run(host="0.0.0.0", port=8080)