Помогите решить проблему, не знаю с чем связана ошибка
from decimal import Decimal
from tkinter import *
window = Tk()
window.title('RSA')
# Variables for checkboxes/listbox
TextVar = StringVar(value=1111)
QVar = StringVar(value=25)
PVar = IntVar(value=37)
letterVar = IntVar()
specialVar = IntVar()
digitalVar = IntVar()
enChar = StringVar()
# Checkboxes
LabelClose = Label(window, width=15, text="Закрытый ключ").grid(row=0, column=3, sticky=E)
LabelClose1 = Label(window, text="")
LabelClose1.grid(row=1, column=3, sticky=E)
labelOpen = Label(window, text="Открытый ключ").grid(row=2, column=3)
LabelOpen1 = Label(window, text="")
LabelOpen1.grid(row=3, column=3, sticky=E)
LabelEncr = Label(window, width=15, text="Зашифрованный текст").grid(row=4, column=3, sticky=E)
LabelEncr1 = Label(window, text="")
LabelEncr1.grid(row=5, column=3, sticky=E)
LabelDecr = Label(window, width=15, text="Дешифрованный текст").grid(row=6, column=3, sticky=E)
LabelDecr1 = Label(window, text="")
LabelDecr1.grid(row=7, column=3, sticky=E)
# Button
button = Button(window, text="Начать", width=12)
button.grid(row=6, column=0, columnspan=1, sticky=E)
# Labels
labelText= Label(window, text="Введите текст:").grid(row=4, column=0)
labelP = Label(window, text="Введите P:").grid(row=0, column=0, sticky=W)
labelQ = Label(window, text="Введите Q:").grid(row=2, column=0, sticky=W)
# Entry
entryP = Entry(window, width=10, textvariable=PVar).grid(row=1, column=0, sticky=W+E)
entryQ = Entry(window, width=22, textvariable=QVar).grid(row=3, column=0)
entryText= Entry(window, width=22, textvariable=TextVar).grid(row=5, column=0)
def gcd(a,b):
if b==0:
return a
else:
return gcd(b,a%b)
p = PVar.get()
q = QVar.get()
no = TextVar.get()
n = int(p)*int(q)
t = (int(p)-1)*(int(q)-1)
e = 1
for e in range(2,t):
if gcd(e,t)== 1:
break
for i in range(1,10):
x = 1 + i*t
if x % e == 0:
d = int(x/e)
break
ctt = Decimal(0)
ctt = pow(int(no),int(e))
print(ctt)
ct = int(ctt) % int(n)
dtt = Decimal(0)
dtt = pow(ct,d)
dt = int(dtt) % int(n)
LabelClose1['text'] = (str(e)+str(n))
LabelOpen1['text'] = (str(d)+str(n))
LabelEncr1['text'] = (str(ct))
LabelDecr1['text'] = (str(dt))
# print('n = '+str(n)+' e = '+str(e)+' t = '+str(t)+' d = '+str(d)+' cipher text = '+str(ct)+' decrypted text = '+str(dt))
# print('Открытый ключ = {' +str(e)+ ', ' +str(n)+ '}')
# print('Закрытый ключ = {' +str(d)+ ', ' +str(n)+ '}')
# print('Зашифрованный текст = '+str(ct))
button.bind('<Button-1>',gcd)
window.geometry("400x250")
window.mainloop()