April 2018
Beginner
340 pages
7h 54m
English
We still have a Friends menu at the top of our FriendsList class, but this doesn't make much sense as a place to put our avatar uploading functionality. Instead, we can create a new submenu called avatar:
...from avatarwindow import AvatarWindow...def __init__(self, **kwargs): ... self.avatar_menu = tk.Menu(self.menu, fg="black", bg="lightgrey", tearoff=0) self.avatar_menu.add_command(label="Change Avatar", command=self.change_avatar) self.menu.add_cascade(label="Friends", menu=self.friends_menu) self.menu.add_cascade(label="Avatar", menu=self.avatar_menu)
After importing our new class, we create a menu called avatar_menu to hold a Change Avatar function. This will call a method named change_avatar:
def change_avatar(self): ...