Begin with a new folder, which will hold all of the code for our chat application. Inside this folder, create a file called friendslist.py. In this file, we will begin writing our FriendsList class:
import tkinter as tkimport tkinter.ttk as ttkclass FriendsList(tk.Tk): def __init__(self, **kwargs): super().__init__(**kwargs) self.title('Tk Chat') self.geometry('700x500') self.canvas = tk.Canvas(self, bg="white") self.canvas_frame = tk.Frame(self.canvas) self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview) self.canvas.configure(yscrollcommand=self.scrollbar.set) self.scrollbar.pack(side=tk.LEFT, fill=tk.Y) self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH) self.friends_area ...