我正在按照以下步骤制作GUI聊天程序:
成功登录后,第一个窗口尚未销毁。 (操作系统:window 7,Python 2.7)
请帮我成功摧毁第一个窗户!
chat_login.py:
from socket import *
import thread, time
import msvcrt as m
from tkinter import *
from tkinter import scrolledtext
import os
import sys
login_w = Tk()
login_w.title("The SCH Chat-Client V0.1")
login_w.geometry('400x100')
s = socket(AF_INET, SOCK_STREAM)
id_label = Label(login_w,text=" I D : " )
id_label.grid(column=0, row=0)
id_txt = Entry(login_w)
id_txt.grid(row=0, column=1)
pass_label = Label(login_w,text="Password : " )
pass_label.grid(column=0, row=1)
pass_txt = Entry(login_w)
pass_txt.grid(row=1, column=1)
def recvMsg(sock):
while True:
recvmsg = sock.recv(1024)
def Con_Clicked():
host = "127.0.0.1"
port = 8008
print host
try:
s.connect((host, 8008))
thread.start_new_thread(recvMsg, (s, ))
time.sleep(1)
nickmsg = id_txt.get()
s.send(nickmsg)
time.sleep(2)
print 'Wait!'
os.system('python chat_client_testG.py')
except:
print "Wrong address!"
con_btn = Button(login_w, text="Login" , command = Con_Clicked )
con_btn.grid(column=0, row=2)
login_w.mainloop()