исправить код язык программирования python 3.9 from tkinter import *
import smtplib as root
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from tkinter import *
from tkinter import messagebox
master = Tk()
master.geometry("439x259")
master.title("Новое оконо")
def opn():
screen = Tk()
screen.geometry( '439x259' )
screen.title( 'Spam to mail by HACKNAZAR' )
screen[ 'bg' ] = '#000'
# Fucntion
def send_mail( event ):
L = login.get()
P = password.get()
U = url.get()
To = toaddr.get()
T = topic.get()
M = mess.get()
N = number.get()
for value in range( int( N ) ):
msg = MIMEMultipart()
msg[ 'Subject' ] = T
msg[ 'From' ] = L
body = M
msg.attach( MIMEText( body, 'plain' ) )
server = root.SMTP_SSL( U, 465 )
server.login( L, P )
server.sendmail( L, To, msg.as_string() )
server.quit()
value += 1
result [ 'text' ] = 'x' + str( value )
# Events
Tlogin = Label( text = 'Login:', font = 'Consolas', fg = '#177317', bg = '#000', relief = 'solid' )
login = Entry( screen, font = 'Consolas' )
Tpassword = Label( text = 'Password:', font = 'Consolas', fg = '#177317', bg = '#000', relief = 'solid' )
password = Entry( screen, font = 'Consolas', show = '*' )
Turl = Label( text = 'URL:', font = 'Consolas', fg = '#177317', bg = '#000', relief = 'solid' )
url = Entry( screen, font = 'Consolas' )
Ttoaddr = Label( text = 'Кому:', font = 'Consolas', fg = '#177317', bg = '#000', relief = 'solid' )
toaddr = Entry( screen, font = 'Consolas' )
Ttopic = Label( text = 'Topic message:', font = 'Consolas', fg = '#177317', bg = '#000', relief = 'solid' )
topic = Entry( screen, font = 'Consolas' )
Tmess = Label( text = 'Message:', font = 'Consolas', fg = '#177317', bg = '#000', relief = 'solid' )
mess = Entry( screen, font = 'Consolas' )
Tnumber = Label( text = 'Number of message:', font = 'Consolas', fg = '#177317', bg = '#000', relief = 'solid' )
number = Entry( screen, font = 'Consolas' )
enter = Button( text = 'Send', font = 'Consolas', width = 18 )
result = Label( text = 'Result:', font = 'Consolas' )
# packers
Tlogin.pack( row = 0, column = 0, sticky = W, padx = 1, pady = 1 )
login.pack( row = 0, column = 1, padx = 1, pady = 1 )
Tpassword.pack( row = 1, column = 0, sticky = W, padx = 1, pady = 1 )
password.pack( row = 1, column = 1, padx = 1, pady = 1 )
Turl.pack( row = 2, column = 0, sticky = W, padx = 1, pady = 1 )
url.pack( row = 2, column = 1, padx = 1, pady = 1 )
Ttoaddr.pack( row = 3, column = 0, sticky = W, padx = 1, pady = 1 )
toaddr.pack( row = 3, column = 1, padx = 1, pady = 1 )
Ttopic.pack( row = 4, column = 0, sticky = W, padx = 1, pady = 1 )
topic.pack( row = 4, column = 1, padx = 1, pady = 1 )
Tmess.pack( row = 5, column = 0, sticky = W, padx = 1, pady = 1 )
mess.pack( row = 5, column = 1, padx = 1, pady = 1 )
Tnumber.pack( row = 6, column = 0, sticky = W, padx = 1, pady = 1 )
number.pack( row = 6, column = 1, padx = 1, pady = 1 )
enter.pack( row = 7, column = 0, padx = 1, pady = 1 )
result.pack( row = 7, column = 1, padx = 1, pady = 1 )
# Bind
enter.bind( ' ', send_mail )
# The end
screen.mainloop()
def ext():
exit()
button = Button(master,text="Open new window",command=opn)
btn = Button(master,text="Закрыть окно",command=ext)
button.pack()
btn.pack()
master.mainloop()