When I tried to make a set of pretty little lines on a canvas in Python, I could not get my For Loop to run correctly. I intended for my For Loop to work similarly to what the commented out bit of code has done. Unfortunately, the code just didn't work at all and only caused an error message.
What I wanted to do with that For Loop was to make the variable "linecounter" to go up 20 in value 20 times, and then make the x-coordinates of the lines increase by 50 pixels to the right each time. With my current code right now, it just simply doesn't work.
Is there something in my For Loop that isn't quite written right?
import tkinter as tk
root = tk.Tk()
root.geometry("960x600")
canvas = tk.Canvas(width=960, height=900, bg='white')
canvas.grid(row=2, column=0, columnspan=3)
##canvas.create_line(0, 50, 0, 100, width=5, fill="black")
##canvas.create_line(50, 50, 50, 100, width=5, fill="black")
##canvas.create_line(100, 50, 100, 100, width=5, fill="black")
##canvas.create_line(150, 50, 150, 100, width=5, fill="black")
##canvas.create_line(200, 50, 200, 100, width=5, fill="black")
##canvas.create_line(250, 50, 250, 100, width=5, fill="black")
##canvas.create_line(300, 50, 300, 100, width=5, fill="black")
##canvas.create_line(350, 50, 350, 100, width=5, fill="black")
##canvas.create_line(400, 50, 400, 100, width=5, fill="black")
##canvas.create_line(450, 50, 450, 100, width=5, fill="black")
##canvas.create_line(500, 50, 500, 100, width=5, fill="black")
##canvas.create_line(550, 50, 550, 100, width=5, fill="black")
##canvas.create_line(600, 50, 600, 100, width=5, fill="black")
##canvas.create_line(650, 50, 650, 100, width=5, fill="black")
##canvas.create_line(700, 50, 700, 100, width=5, fill="black")
##canvas.create_line(750, 50, 750, 100, width=5, fill="black")
##canvas.create_line(800, 50, 800, 100, width=5, fill="black")
##canvas.create_line(850, 50, 850, 100, width=5, fill="black")
##canvas.create_line(900, 50, 900, 100, width=5, fill="black")
##canvas.create_line(950, 50, 950, 100, width=5, fill="black")
##canvas.create_line(1000, 50, 1000, 100, width=5, fill="black")
for linecounter 1 to 20
canvas.create_line((linecounter * 50), 50, (linecounter * 50), 100, width=5, fill="black")
root.mainloop()