diff --git a/Client.py b/Client.py index d364666..ea6ed50 100644 --- a/Client.py +++ b/Client.py @@ -10,8 +10,16 @@ def receiveMessage(): sends EndOfMessage and displays the recieved messages on the user interface''' + global username + username = "User" + message = thisSocket.recv(1024).decode() + print(message) while (message != "EndOfMessage"): + if username == "User" and "YOURNAMEWILLBE" in message: + nameholder = message.split()[1:] + username = nameholder[1:] + continue chatHistory.configure(state="normal") thisSocket.send("Received".encode()) chatHistory.insert(tk.END, "Jeff: " + message + "\n") @@ -30,7 +38,7 @@ def sendMessage(event): thisSocket.send(sMessage.encode()) chatHistory.configure(state="normal") - chatHistory.insert(tk.END, "User: " + sMessage + "\n") + chatHistory.insert(tk.END, username + ": " + sMessage + "\n") chatHistory.see(tk.END) chatHistory.configure(state="disabled") userInput.delete(0, tk.END) diff --git a/__pycache__/Get_Functions.cpython-36.pyc b/__pycache__/Get_Functions.cpython-36.pyc index a6429a1..536bb5c 100644 Binary files a/__pycache__/Get_Functions.cpython-36.pyc and b/__pycache__/Get_Functions.cpython-36.pyc differ