def new_window(self):

        #bot init see ChatBot
        self.bot = ChatBot()

        #Gui initi see ChatGUI
        self.gui = ChatGUI(self.master, self.bot)

        #binds the enter button for the user input to the enter() method
        #when enter is pressed the enter method is called 
        button = self.gui.enterButton
        self.master.bind('<Return>', (lambda event: self.enter()))        
        #welcome msg from the system
        self.gui.updateChat("Welcome to the chatbot 4000 \n")
        self.gui.updateChatBot("Hello there! My name is " + self.bot.botName + ". How can I help you today?") 
Exemplo n.º 2
0
def userRefresher():
    while True:
        Requests.listUsers()
        time.sleep(2.5)


def messageSentTo(toNickName, text):
    global usersToId
    myId = usersToId[nickname]
    toId = usersToId[toNickName]
    Requests.sendTo(myId, toId, text)


Requests.register(nickname)
chatGui = gui.ChatGUI(600, 600, nickname, messageSentTo)


def availableUserHandler(message):
    global usersToId
    global nickname
    usersToId = copy.deepcopy(message)
    usersList = list(usersToId.keys())
    usersList.remove(nickname)
    if usersList:
        chatGui.updateAvailableUsers(usersList)


def newMessageFrom(fromId, text):
    global usersToId
    for user, userId in usersToId.items():