This is very strange and I wonder if there’s any fix besides “add extra space at the bottom”
Here’s some sample code to explain what I’m doing:
from tkinter import *
root = Tk()
root.geometry("100x300")
scrollbar = Scrollbar(root)
scrollbar.pack( side = RIGHT, fill=Y )
box = Text(root, wrap="char", cursor="arrow", yscrollcommand=scrollbar.set, font=("Helvetica", 30))
box.pack(fill="both", expand=True)
scrollbar.config( command = box.yview )
scrollbar.lift()
for i in range(5):
box.insert(INSERT, f"Button {i+1} ")
root.mainloop()
This works amazing and this is what the max scroll looks like:
However, once I put everything in a Frame there’s a problem
Code:
from tkinter import *
root = Tk()
root.geometry("100x400")
frame = Frame(root)
frame.place(x=0, y=100, relwidth=1, relheight=1)
scrollbar = Scrollbar(frame)
scrollbar.pack( side = RIGHT, fill=Y )
box = Text(frame, wrap="char", cursor="arrow", yscrollcommand=scrollbar.set, font=("Helvetica", 30))
box.pack(fill="both", expand=True)
scrollbar.config( command = box.yview )
scrollbar.lift()
for i in range(5):
box.insert(INSERT, f"Button {i+1} ")
root.mainloop()
And the max scroll looks like this:
As you can see, at least 2 lines in the text widget were cutoff, and I have no idea why. Can someone help out?
1