当我运行一个函数时,Tkinter停止响应

时间:2017-03-14 00:30:51

标签: python tkinter

我是Python的新手,我有一个简单的Tkinter程序,可以将您登录到您的Gmail帐户并检查服务器以验证您的登录信息

from EmailServer import CheckServer

from Tkinter import *
import smtplib
win = Tk()
usr = Label(win, text="Username")
psw = Label(win, text="Password",)
username = Entry(win)
password = Entry(win, show="*")
def Login():
    username1 = username.get()
    password1 = password.get()
    CheckServer(username1, password1)

b = Button(win, text="Login",command=Login)
quit = Button(win, text="Exit",command=exit)
quit.grid(row=2, column=1)
username.grid(row=0, column=1)
password.grid(row=1, column=1)
psw.grid(row=1, column=0)
usr.grid(row=0, column=0)
b.grid(row=2, column=0)

它从这里获得CheckServer功能

def CheckServer(username,password):
    import smtplib
    server = smtplib.SMTP('smtp.gmail.com:587')
    server.starttls()
    server.login(username,password)
    print "checked"

但是当我运行它时,一切都显示出来,但是当我输入所有内容并按下登录按钮时,它会冻结并停止响应我不知道是什么导致问题,任何想法?

0 个答案:

没有答案