1
Problems rendering Python Turtle on different browsers
h
BenFraser (0)

I'm having trouble getting Turtle to render properly on certain browsers. It draws properly up until a certain point then fails and shoots off the canvas. It does it in the same place every time but if I remove the the line of code where I apply the color method it'll go further before crashing. On my computer it works fine on Safari but not Chrome. Not sure about windows yet.

My first thought is that It's hitting a memory limit in chrome. Any thoughts or help out there?

Here is an example: https://repl.it/@BenFraser/Bug

You are viewing a single comment. View All
1
malvoliothegood (83)

Your code works fine when I run it using Firefox on a Linux system. You might be interested in this code that draws a spiral:

import turtle
from random import randint

fred = turtle.Turtle()
fred.speed(0)

turn_angle = 10
side = 400

for j in range(100):
  r = randint(0, 255)
  g = randint(0, 255)
  b = randint(0, 255)
  fred.fillcolor(r,g,b) 
  fred.begin_fill()
  for i in range(4):     
    fred.forward(side)
    fred.right(90)
  side -= 4
  fred.end_fill()
  fred.right(turn_angle)