O'Reilly logo

Tkinter GUI Programming by Example by David Love

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating our ChatWindow class to send requests to the server

With all of the heavy lifting passed over to our other classes, the changes required to our ChatWindow class should be very simple.

Firstly, let's update it so that the messages we send are sent to the web service and stored in a conversation database:

def send_message(self, event=None):    message = self.text_area.get(1.0, tk.END)    if message.strip() or len(self.text_area.smilies):        self.master.requester.send_message(            self.master.username,            self.friend_username,            message,        )        message = "Me: " + message        self.messages_area.configure(state='normal')        self.messages_area.insert(tk.END, message)        ...

Before adding the Me : and incorporating the smileys into our messages_area, we fire off a request ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required