Hello, I am trying to read a text file store each line in a different array.
Then use Python Turtle to draw those coordinates.
Right now I am unable to build that array. How do I store each line in a different array and how do I reference it?
For example this is what I have now, and it works. but only for the first line.
Once each line of plot points is in a different array, I need it draw the next array.
import turtle
import os
file_directory=os.path.dirname(__file__)
movements=""
with open(file_directory+'\\plot_points.txt',"r") as themovement:
movements=movements+themovement.readlines()
themovement.close()
mlist=movements.split(",")
print(mlist)
for counter in range(0,len(mlist)):
mlist[counter] = int(mlist[counter])
turtle.color("black", "darkgrey")
total_length=int(len(mlist))
turtle.penup()
turtle.goto(mlist[0],mlist[1])
turtle.pendown()
turtle.begin_fill()
for counter in range(2, total_length, 2):
turtle.goto(mlist[counter],mlist[counter+1])
turtle.end_fill()
turtle.hideturtle()
input("Press Any Key")