I have this code which works on Skulpt, but didn't work on Brython on local server? Why?Can you help me?
<!doctype html>
<html>
<head>
<script type=text/javascript src="../src/brython.js"></script>
<script id="python_script" type="text/python">
from browser import document, console
_code=document["div_html"].text
exec(_code)
document["processing"].style.display="none"
</script>
<style type="text/css">
.blink {
animation: blink 1s steps(5, start) infinite;
-webkit-animation: blink 1s steps(5, start) infinite;
}
@keyframes blink {
to { visibility: hidden; }
}
@-webkit-keyframes blink {
to { visibility: hidden; }
}
</style>
</head>
<body onload="brython(1)">
<pre id="div_html" style="float:left">
#
# SOURCE CODE
#
import random
import turtle
def tree(size, myTurtle):
myTurtle.pensize(size / 10)
if size < random.randint(1,2) * 20:
myTurtle.color("green")
else:
myTurtle.color("brown")
if size > 5:
myTurtle.forward(size)
myTurtle.left(25)
tree(size - random.randint(10, 20), myTurtle)
myTurtle.right(50)
tree(size - random.randint(10, 20), myTurtle)
myTurtle.left(25)
myTurtle.penup()
myTurtle.backward(size)
myTurtle.pendown()
window = turtle.Screen()
window.bgcolor("black")
myTurtle = turtle.Turtle()
myTurtle.color("brown", "blue")
myTurtle.left(90)
myTurtle.speed(0)
myTurtle.penup()
myTurtle.setpos(0, -250)
myTurtle.pendown()
tree(120, myTurtle)
turtle._Screen().end()
</pre>
<div id="container"
style="float:left;border-style:solid;border-color:black;margin-left:50px"></div>
</body>
<div id="processing" class="blink"
style="color:red;position:absolute;z-index:100;width:250px;height:100px;top:50%;left:50%;margin 0 auto;">Processing... Please wait..
</div>
</html>
I use your code in turtle.html from gallery but still have "Processing...Please wait" on my browser.
http://imgur.com/a/LsSUC
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+unsubscribe@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/b5ff17ac-e9ec-414c-aca8-545be8b4971a%40googlegroups.com.
Now works fine. Can I speed up animation of turtle?
Something like
t1.speed(0)
Also how change the drawing area?
In Skulpt I use:
window.setup(800,600)
Thanks
--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+unsubscribe@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/0c8e9741-a4f8-46cf-855b-dd6deffdc7ad%40googlegroups.com.
Is there a CDN for the latest latest development version ?
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAAb4jGmsK7Xq4xdud2PSYSGxgjppCA34fGs3wt79L%3De6BszbqQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/CAB-sx60mqmz5J1DPePgr_9i48HjQTCqdJwktK8w2aVfYeKS0%3DQ%40mail.gmail.com.
Now works fine. Can I speed up animation of turtle?
Something like
t1.speed(0)
Also how change the drawing area?
In Skulpt I use:
window.setup(800,600)
Thanks
W dniu poniedziałek, 3 października 2016 08:06:30 UTC+2 użytkownik Pierre Quentel napisał: