Mar-04-2019, 12:22 AM
Hello! I am fairly new to python and i am taking over a project from a previous student. In this portion of the code that I was given, I keep getting an IndexError. If anybody has anything that can help, please feel free. Thank you!
#Name Labels and Angular Displacement Sliders names = ["Servo {}:".format(8-x) for x in range(8)] jointLabels = [] jointScales = [] for x in range(8): jointLabels.append(Tkinter.Label(individualServoControlFrame, text = names[x])) jointLabels[x].grid(row = x+1, column = 0, sticky="SE") if window.dropBoxServoModelVariable.get() == 'AX-12' or window.dropBoxServoModelVariable.get() == 'AX-18': jointScales.append(Tkinter.Scale(individualServoControlFrame, from_ = 0, to = 296.67, resolution = 0.01, width = 15, length = 150, orient = "horizontal")) #Creating sliders elif window.dropBoxServoModelVariable.get() == 'MX-28': jointScales.append(Tkinter.Scale(individualServoControlFrame, from_ = 0, to = 360.36, resolution = 0.01, width = 15, length = 150, orient = "horizontal")) #Creating sliders jointScales[x].grid(row = 8-x, column = 1) <----------(THIS IS THE LINE THAT KEEPS GETTING THE ERROR) setattr(window, "jointScales", jointScales) setattr(window, "jointLabels", jointLabels)