From 0d443090e87527a2145c8e20a3b5e3f8ad886bd9 Mon Sep 17 00:00:00 2001 From: Richard Horton Date: Wed, 8 Nov 2017 12:49:25 +0000 Subject: [PATCH] Started trying to use the name of the user but not working --- Client.py | 10 +++++++++- __pycache__/Get_Functions.cpython-36.pyc | Bin 2063 -> 2077 bytes 2 files changed, 9 insertions(+), 1 deletion(-) 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 a6429a11c35d0068e0e072a12be096aae12495e7..536bb5c0ce1caafb38f4bfa1a7d02cd5fdaf05f7 100644 GIT binary patch delta 64 zcmeAdm@B|$%*)Fq=eCjU1+%t?hgFPoer`c&NotWoaB^m9UUF)TqmNIFb4FrGQhrHH TP-;Pbab`(=QRQZC78Vu&gd-H@ delta 50 zcmbO$&@aGd%*)HQ*k&W!3uaj>533kQA0Gu>g@B^`tkmQZ1w#c5=ZwS>r~DGl&5|rE FEC64U4ZHvV