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

Implementing the ListeningThread class in our ChatWindow

To make use of our new ListeningThread, we just need to import it and call its start method:

...from listeningthread import ListeningThread...def __init__(self, master, friend_name, friend_username, friend_avatar, **kwargs):    ...    self.listening_thread = None    self.listen()

After importing the class, we add a listening_thread attribute to our __init__ method, then call the listen method to get our ListeningThread running:

def listen(self):    self.listening_thread = ListeningThread(self, self.master.username,                                             self.friend_username)    self.listening_thread.start()

We set our listening_thread attribute to an instance of the ListeningThread class, passing it our username and friend_username. We ...

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