Make the contents of a tabControl tab scrollable while it still functions as a tab - tkinter
Solution 1:
You've put the canvas in the main frame rather than in a tab. If you want it to be in a tab, it needs to be a child of the frame for a tab.
main_frame = Frame(tab_A)
# ^^^^^
Unrelated to the question that was asked, I recommend using pack
rather than grid
for widgets that are the only child, or one of only a couple of children in a containing widget. It requires a little bit less code and is a bit more foolproof since you don't have to worry about adding weights to the only row and column.
For example, it takes a single line of code to get the notebook to fill the window and to grow and shrink as it resizes:
tabControl.pack(fill="both", expand=True)
The same is true for main_frame
since it's the only widget in the tab frame.
main_frame.pack(fill="both", expand=True)
And finally, pack
also makes laying out a widget and it's scrollbar very easy:
my_scrollbar.pack(side="right", fill="y")
my_canvas.pack(side="left", fill="both", expand=True)