I need to figure out how to control the self._newline(), in turtle.py. I found out about this during my python Mandelbrot set program, when it started doing weird things; see Why is turtle lightening pixels? for more details. However, when I tried to make an extremely similar program that graphed the tangent of complex numbers, the same thing did not happen...but the program slowed down considerably over time.
Basically, I am asking 3 questions:
What is the difference between these programs that causes this discrepancy? (intellectual inquiry)
How do I activate/stop self._newline()? (Necessary, main question)
How do I keep self._newline() from causing color deviations (DSM suggested that I insert self._pencolor() references into turtle.py, but I have no idea how to do this)? (Not necessary, but desired)
Even if you do not answer the middle question, your input will still be greatly appreciated!
Complex tangent code:
import turtle
import math
import cmath
turtle.speed(0)
def bengant(size, onelen):
turtle.left(90)
for x in range(-size*onelen, size*onelen+1):
turtle.up()
turtle.goto(x, -size*onelen-1)
turtle.down()
for y in range(-size*onelen, size*onelen+1):
c = complex(x*1.0/onelen,y*1.0/onelen)
k = cmath.tan(c)
turtle.pencolor(0,math.atan(k.real)/math.pi+1/2,math.atan(k.imag)/math.pi+1/2)
turtle.forward(1)
bengant(2,100)
x = raw_input("Press Enter to Exit")