Tkinter labels won't fill Y dir. after pack, even w/ fill=tk.Y

I am having two issues with my tkinter window:

  1. Labels are not filling the Y direction even though fill=tk.Y is called for self.firstlabel.pack and x.pack.
  2. When calling self.update() and then printing the canvas height with print(self.canvas.winfo_height()), it is still 1.

I have looked at various sources but have not been able to resolve these issues. Any help would be appreciated.

Issue 1 Solution:

Try adding expand=True parameter to the pack method calls for self.firstlabel and x.


self.firstlabel.pack(fill=tk.Y, expand=True)
x.pack(fill=tk.Y, expand=True)

Issue 2 Solution:

Try calling self.canvas.update_idletasks() before printing the canvas height. This will force the canvas to update its dimensions.