does anyone have any idea on how can i write the inserted text to a label in a .txt file?
my code:
from tkinter import *
root = Tk()
root.title('مستلزمات البيت')
label1 = Entry(root, width=30)
label1.grid(row=1, column=0, columnspan=3)
e = ["-", label1]
lable2 = Label(root, text="اسم الغرض ")
lable2.grid(row=0, column=2)
f = open("house.txt", "a")
def clear():
f.write(e[1])
label1.delete(0, END)
f.close()
enter_btn = Button(root, width=80, padx=50, pady=50, text="تأكيد", command=clear)
enter_btn.grid(row=2, column=0, columnspan=3)
root.mainloop()
when i run it this appears :
File "C:\Users\yahya.ashwaq-PC\PycharmProjects\jad el jad\mostalzamat.py", line 21, in clear
f.write(e[1])
TypeError: write() argument must be str, not Entry