I want to replace the widgets in the tkinter gui, but when I am using .destroy
, I am getting the object nonetype has no attribute destroy
, I am not able to use a for
loop to use .win_children
and then for child in children.
This is the code:
import tkinter as tk
import smtplib
win = tk.Tk()
win.title("Email Automater")
win.geometry('400x200')
def sendEmail(to, content):
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('parvanshusharma12@gmail.com', '*********')
server.sendmail('parvanshusharma12@gmail.com', to, content)
server.close()
def mailGui():
tk.Label(win, text="Message:").place(x=20, y=20)
msg = tk.Entry(win, width=250).place(x=230, y=50)
tk.Label(win, text="To:").place(x=20, y=20)
to_mail = tk.Entry(win, width=25).place(x=20, y=50)
tk.Label(win, text="From:").place(x=230, y=20)
from_mail = tk.Entry(win, width=25).place(x=230, y=50)
tk.Label(win, text="From Password:").place(x=230, y=80)
from_mail = tk.Entry(win, show='*', width=25).place(x=230, y=110)
tk.Button(win, text="Done!", command=mailGui).place(x=230, y=150)
win.mainloop()