def input_thread(self): server = ChatServer(self.prefix) thread = threading.Thread(target=server.listen) thread.start() while True: text = self.textbox.edit() self.input_sc.erase() if text == "": continue #self.write(text) server.send_message(text)
def main(self): chatnet = ChatNet("/chat", self.callback) chatsrv = ChatServer("/chat") t = threading.Thread(target=chatsrv.listen) t.start() i = 0 while True: message = "number %d" % i print("Sending: %s" % message) r = chatnet.pullData() chatsrv.send_message(message) i += 1 time.sleep(1)