How to use content into 'text_first' as argument 'source' and content into 'text_second' as argument 'direction' in function 'encrypt_file' ? I tried to do like in code below, but it doesnt work. Appreciate your any reply.
# file name fields
text_first = Text(
font='Arial 14',
)
text_first.place(x=20, y=150, height=33, width=520)
text_second = Text(
font='Arial 14',
)
text_second.place(x=20, y=275, height=33, width=520 )
text_third = Text(
font='Arial 14',
)
text_third.place(x=20, y=400, height=33, width=520)
# update button
def encrypt_file_data(key, data):
fn = Fernet(key)
return fn.encrypt(data)
def encrypt_file(key, source, destination):
with open(source, 'rb') as file:
file_data = file.read()
encrypted = encrypt_file_data(key,file_data)
with open(destination, 'wb') as file:
file.write(encrypted)
tkinter.Button(
text='Update erstellen',
width=93,
height=3,
font=('Arial', 10, 'bold'),
command=lambda: encrypt_file('M-Gx3UOPC2B8Xo6smM8MyMU51aP8aoKEyrz-ZkUdpOI=', source=text_first.get('1.0', 'end-1c'), destination=text_second.get('1.0', 'end-1c')
).place(x=20, y=490)
tkinter.mainloop()