#!/usr/bin/env python3 from tkinter import * from _thread import start_new_thread from socket import * from struct import * def display_string(mtype, username): if(mtype == 0): return "Existing User: " + username + "\n" if(mtype == 1): return "New Login: " + username + "\n" if(mtype == 2): return "Logout: " + username + "\n" print("Server is very confused this morning" + "\n") class UsernameClient(Frame): def __init__(self, master): Frame.__init__(self, master) self.pack(fill='both', expand=1) self.textwindow = Frame(self) self.controls = Frame(self) self.controls.pack(side=RIGHT) self.textwindow.pack(side=LEFT, fill='both', expand=1) self.editor = Text(self.textwindow) self.editor.pack(fill='both', expand=1) self.connect_button = Button(self.controls, text="Connect", command=self.connect) self.connect_button.pack() self.change_own_text = Button(self.controls, text="Goose", command=self.change_text) self.change_own_text.pack() def change_text(self): self.editor.insert("end", "Goose\n") def receive_username(self): mtype, length = unpack("