text_box is a tkinter text box I am trying to convert source_text's letters to the number corresponding to the position of said letter such that a or A = 1, b or B = 2 and print it the console
def enter():
#don't use 1 in place of 1.0
source_text=text_box.get(1.0, END)
def alphabet_position(text):
dict = {'a':'1','b':'2','c':'3','d':'4','e':'5','f':'6','g':'7','h':'8','i':'9','j':'10','k':'11','l':'12','m':'13','n':'14','o':'15','p':'16','q':'17','r':'18','s':'19','t':'20','u':'21','v':'22','w':'23','x':'24','y':'25','z':'26'}
new_text = text.lower(source_text)
for i in new_text:
if i in dict:
new_text = new_text.replace(i, dict[i])
print (new_text)
enter is called as such
btn = Button(root, text = "Enter", command = enter)