+ 2
GUI-Based Python code in Webpage
I have the following Python code: https://sololearn.com/compiler-playground/cI8u3i2b4z9V/?ref=app And I want to run it in a webpage. Do note that it uses GUI graphics. I tried and barely got Pyscript running, then looked into other ones, but the GUI graphics from turtle isn't supported in any of the JavaScript libraries for running Python which I found(Brython, Pyodide). Is it possible to implement the code in my webpage, and if it is, how so?
3 odpowiedzi
+ 2
Afnan Irtesum Chowdhury
Yes, you can run your code in web compiler using skulpt.
Here is a example of how can you use turtle in your webpage:
https://sololearn.com/compiler-playground/W4gB8gfenNFH/?ref=app
Skulpt doesn't support all python standard library modules and unfortunately colorsys isn't available in Skulpt's supported built-ins.
To solve the issue, you can manually re-implement colorsys functions in Python.
+ 1
Gulshan Mahawar I modified the code, but the canvas stays pitch black(empty), no changes happen
EDIT: Got it to work, now just gotta fix the color(same color in all stars).
https://sololearn.com/compiler-playground/WYhf79dzRRiP/?ref=app
0
Afnan Irtesum Chowdhury
Try this:
`print(h)
print(r,g,b)
`
I found that h is getting modified in the loop but r,g,b isn't changing. That's pretty weird.