I am having two issues with my tkinter window:
- Labels are not filling the Y direction even though
fill=tk.Y
is called for self.firstlabel.pack
and x.pack
.
- 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
.
Example:
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.
Example:
self.update()
self.canvas.update_idletasks()
print(self.canvas.winfo_height())