Basically, my code runs a turtle and asks the user for measurements of the lengths for the shape. I just need to know why it isn't working. You can run it on Python to see exactly what I mean.
import turtle
import tkinter as tk
quest = None
Input = None
w = None
s = None
a = None
d = None
def forward():
t.forward(w)
def back():
t.back(s)
def left():
t.left(a)
def right():
t.right(d)
def whaat():
global quest
global w
global s
global a
global d
print('What would you like to set?')
what = input('Would you like to set forward, back, left, or right?: ')
if what == 'forward' or what == 'FORWARD' or what == 'Forward':
w = input('How FAR would you like ''Turtle'' to move (forward): ')
w = int(w)
quest = input('Would you like to Set Anything Else? (y or n): ')
if quest == 'y' or quest == 'yes' or quest == "YES":
whaat()
else:
root = tk.Tk()
canvas = tk.Canvas(master = root, width = 500, height = 500)
canvas.pack()
t = turtle.RawTurtle(canvas)
tk.Button(master = root, text = "Forward", command = forward).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Back", command = back).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Left", command = left).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Right", command = right).pack(side
= tk.LEFT)
root.mainloop()
elif what == 'back' or what == 'BACK' or what == 'Back':
s = input('How FAR would you like ''Turtle'' to move (back): ')
s = int(s)
quest = input('Would you like to Set Anything Else? (y or n): ')
if quest == 'y' or quest == 'yes' or quest == "YES":
whaat()
else:
root = tk.Tk()
canvas = tk.Canvas(master = root, width = 500, height = 500)
canvas.pack()
t = turtle.RawTurtle(canvas)
tk.Button(master = root, text = "Forward", command = forward).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Back", command = back).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Left", command = left).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Right", command = right).pack(side
= tk.LEFT)
root.mainloop()
elif what == 'left' or what == 'LEFT' or what == 'Left':
a = input('What ANGLE would you like ''Turtle'' to move (left): ')
a = int(a)
quest = input('Would you like to Set Anything Else? (y or n): ')
if quest == 'y' or quest == 'yes' or quest == "YES":
whaat()
else:
root = tk.Tk()
canvas = tk.Canvas(master = root, width = 500, height = 500)
canvas.pack()
t = turtle.RawTurtle(canvas)
tk.Button(master = root, text = "Forward", command = forward).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Back", command = back).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Left", command = left).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Right", command = right).pack(side
= tk.LEFT)
root.mainloop()
elif what == 'right' or what == 'RIGHT' or what == 'Right':
d = input('What ANGLE would you like ''Turtle'' to move (right): ')
d = int(d)
quest = input('Would you like to Set Anything Else? (y or n): ')
if quest == 'y' or quest == 'yes' or quest == "YES":
whaat()
else:
root = tk.Tk()
canvas = tk.Canvas(master = root, width = 500, height = 500)
canvas.pack()
t = turtle.RawTurtle(canvas)
tk.Button(master = root, text = "Forward", command = forward).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Back", command = back).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Left", command = left).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Right", command = right).pack(side
= tk.LEFT)
root.mainloop()
else:
print('Incorrect Statement, Please Try Again')
whaat()
def which():
global Input
global w
global s
global a
global d
Input = input('Would you like to set your buttons?: ')
if Input == 'y' or Input == 'yes' or Input == 'YES' or Input == 'Yes':
whaat()
elif Input == 'n' or Input == 'no' or Input == 'NO' or Input == 'No':
w = 100
s = 100
a = 90
d = 90
root = tk.Tk()
canvas = tk.Canvas(master = root, width = 500, height = 500)
canvas.pack()
t = turtle.RawTurtle(canvas)
tk.Button(master = root, text = "Forward", command = forward).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Back", command = back).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Left", command = left).pack(side
= tk.LEFT)
tk.Button(master = root, text = "Right", command = right).pack(side
= tk.LEFT)
root.mainloop()
else:
print('Incorrect Statement, Please Try Again')
which()
which()
Thanks a lot for helping, it really is appreciated!