Python Tkinter:Frames are not going under each otheer

I was making a simple tkinter GUI which has scrolling frames in it but it is not being so perfect for me.At first I used only one frame, but however I found out that frames have a limit on the no. of widgets they can hold,so I started using multiple frames. However I got this problem:the frames are not going in the direction I wanted.I wanted the frames to go under the previous frame ,however the frames are going one above the other here is a screenshot of the same: enter image description here

(Frame 0 is the first Frame)

Here is the code(I have only kept the important portion)

i=0
image_no=0
for video in videos:
    
    u = urllib.request.urlopen(video["thumbnail"]["thumbnails"][0]["url"])
    raw_data = u.read()
    u.close()

    im = Image.open(BytesIO(raw_data))
    image = ImageTk.PhotoImage(im.resize((470,210)))
    a.append(image)

    tk.Label(fr[i], image=a[image_no]).pack()
    image_no+=1
    tk.Label(fr[i], text=("Video:"+str(image_no)+" frame:"+str(i)),wraplength=470,font=("ariel",11,"bold"),bg="white").pack()
    tk.Label(fr[i], text=video["title"]["accessibility"]["accessibilityData"]['label'].replace(video["title"]["runs"][0]["text"],""),wraplength=470,font=("ariel",10),bg="white",fg="grey").pack(anchor="w")
    canvas.configure(yscrollcommand=scroll_y.set)

    canvas.configure(scrollregion=canvas.bbox("all"))
    print(image_no)
    print(video["title"]["runs"][0]["text"])
    if image_no%10==0:
        time.sleep(3)
    if image_no%110==0:
        i+=1
    if image_no%440==0:
        break

Is there any way I could make it go downwards?

Edit:

Here is the screenshot of the frame limit

enter image description here

the black area is of the canvas

Answer

Here is a link to question tkinter maximum canvas size?

I’ve modified the code due to the possibility that the number of images may be responsible or the canvas may have some maximum height.

This will now fill the entire canvas height with images, each with a 10 point space between.

I’ve updated it for python 3.x and increased height to 100000!

Works without problems.

Choose your own image (gif or png)

import tkinter as tk
from tkinter import filedialog as fido

root = tk.Tk()
root.rowconfigure(0, weight = 1)
root.columnconfigure(0, weight = 1)

picture = fido.askopenfilename(title = "Pick a pic")

iconimage = tk.PhotoImage(file = picture)
wide, high = iconimage.width(), iconimage.height()

frame = tk.LabelFrame(root, labelanchor = "s", text = "0|0")
frame.grid(row = 0, column = 0, sticky = "nsew")
frame.rowconfigure(0, weight = 1)
frame.columnconfigure(0, weight = 1)

cv = tk.Canvas(
    frame, width = 1200, height = 700,
    scrollregion = "0 0 2000 100000")
cv.grid(row = 0, column = 0, sticky = "nsew")

vscrollbar = tk.Scrollbar(
    frame, orient = "vertical", command = cv.yview)
vscrollbar.grid(row = 0, column = 1, sticky = "ns")
cv.config(yscrollcommand = vscrollbar.set)

def rowcol(ev):
    frame["text"] = f"{cv.canvasx(ev.x)} | {cv.canvasy(ev.y)}"

cv.bind("<Motion>", rowcol)
root.update()

testimage = []
for pos in range( 0, 100000 - high - 10, high + 10):
     testimage.append(cv.create_image(100, pos, anchor = "nw", image = iconimage))

print(f"Number of images = {len(testimage)}, width = {wide}, height = {high}")

root.mainloop()

So it doesn’t seem to be a limitation of Canvas height or number of images displayed.