Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import* # do and val are inputs for the function
- from tkinter import*
- x = 6
- reset()
- def TC (do,val): #So TC is the function name - needs to be called when running the program
- do = do.upper() #converts all to CAPITAL letters
- if do =='F':
- forward(val) # Turns a do value of F into turtle command forward
- elif do == 'B':
- backward(val)
- elif do == 'R':
- right(val)
- elif do == 'L':
- left(val)
- elif do == 'U':
- penup()
- elif do == 'D':
- pendown()
- elif do == 'N':
- reset()
- else:
- print('Duds command, you lump!')
- def fAction():
- TC('f',i)
- def bAction():
- TC('b',i)
- def rAction():
- TC('r',i)
- def lAction():
- TC('l',i)
- def uAction():
- TC('u',i)
- def dAction():
- TC('d',i)
- def nAction():
- TC('n',i)
- window = Tk()
- buttonF = Button(window, text="Forward", command=fAction)
- buttonB = Button(window, text="Backward", command=bAction)
- buttonR = Button(window, text="Right", command=rAction)
- buttonL = Button(window, text="Left", command=lAction)
- buttonU = Button(window, text="Penup", command=uAction)
- buttonD = Button(window, text="Pendown", command=dAction)
- buttonN = Button(window, text="Reset", command=nAction)
- L1 = Label(window, text="Value")
- L1.pack(side = LEFT)
- E1 = Entry(window, bd =5)
- E1.pack(side = RIGHT)
- buttonF.pack()
- buttonB.pack()
- buttonR.pack()
- buttonL.pack()
- buttonU.pack()
- buttonD.pack()
- buttonN.pack()
- if x>5:
- i = E1.get()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement