我正在尝试创建一个python文件,用于向目录发送.txt文件的垃圾邮件。
我决定开始使用Tkinter,但每当我尝试输入数字时,出现以下错误消息"TypeError:int()参数必须是字符串、类似字节的对象或数字,而不是'NoneType'"
我正在使用的代码是:
from tkinter import *
top = Tk()
top.geometry("400x250")
Amount = Label(top, text = "Amount").place(x = 30,y = 50)
def spam():
for i in range(int(e1)):
print(i)
sbmitbtn = Button(top, text = "Submit",activebackground = "pink", activeforeground = "blue",command=spam).place(x = 30, y = 170)
e1 = Entry(top).place(x = 80, y = 50)
top.mainloop()
我尝试将
for i in range(int(e1)):
替换为
for i in range(str(e1)):
但是我得到了错误消息:
"TypeError: 'str' object cannot be interpreted as an integer"
有所帮助总是好的