I'm trying to make a live chat and after I'm done I get the Indentation-Error and the code down below is where the error is according to python.
def recevied_message_from_server(self, so):
while True:
Buffer = so.recv(256)
if not buffer:
break
message = buffer.decode('utf-8')
if "joined" in message:
user = message.split(": ")[1]
message = user + " has joined"
self.chat_area.insert('end', message + '\n')
self.chat_area.yview(END)
else:
self.chat_area.insert('end', message + '\n')
self.chat_area.yview(END)
so.close()
Two things to note here:
break
statement, the indentation is a bit offCheck the below mentioned edited function once for reference:
def recevied_message_from_server(self, so):
while True:
Buffer = so.recv(256)
if not buffer:
break
message = buffer.decode('utf-8')
if "joined" in message:
user = message.split(": ")[1]
message = user + " has joined"
self.chat_area.insert('end', message + '\n')
self.chat_area.yview(END)
else:
self.chat_area.insert('end', message + '\n')
self.chat_area.yview(END)
so.close()