txt = txt[0:index1] + txt[index1 + 1:index2] + txt[index2 + 1:] for j in range(int(words[index + 1]) - 1): processText(txt) words[index + 2] = words[index + 2].replace("[", "") words[i - 1] = words[i - 1].replace("]", "") i = index elif words[i] == "label": turtle.canvas.create_text(turtle.x + turtle.xOff, turtle.y + turtle.yOff, anchor='nw', text=words[i + 1]) i += 1 i += 1 if __name__ == '__main__': gui = gui(width, height, "Logo Interpreter") text = "" turtle = Turtle(0, 0, width, height, gui.canvas) while 1: gui.update() gui.update_idletasks() turtle.display(gui.canvas) if canGet: text = gui.text.get() canGet = False processText(text) time.sleep(0.01) gui.mainloop()