我尝试创建一个简单的可滚动框架,但同时我发现内部框架中显示的小部件数量不超过1559。
框架只能垂直放置1560个小部件吗?
from Tkinter import *
def con(event):
canvas.configure(scrollregion=canvas.bbox("all"))
window = Tk()
outframe = Frame(window,width=300,height=300,bg="red")
outframe.pack()
canvas = Canvas(outframe,width=200,height=200,bg="blue")
inframe = Frame(canvas,width=200,height=200,bg="red")
bar = Scrollbar(outframe)
bar.pack(side="right",fill="y")
canvas.configure(yscrollcommand=bar.set)
bar.configure(command=canvas.yview)
canvas.pack()
canvas.create_window((0,0),window=inframe,anchor='nw')
inframe.bind("<Configure>",con)
for i in range(2000):
Label(inframe,text=str(i)).grid(row=i,column=0)
window.mainloop()
答案 0 :(得分:0)
画布的大小有一个限制,这限制了画布中物体的大小。