部分显示 Python 的滚动条

时间:2021-06-03 22:57:03

标签: python tkinter scrollbar

所以我有一个滚动条,它运行得很好,但没有完全显示出来,总会留下一两行。知道为什么吗?

代码如下:

lst=[('Nom','Total ','#Item')]
root=Tk()
root.geometry("400x400")
root.configure(bg='#bdcabd')
root.title("Fichier de compabilité a 13%")

#I cut part of the code since it was not relevant to the matter at hand
    
Sfrm=LabelFrame(root, text="Data du Fichier")
Sfrm.place(height=255, width=500)

cnva=Canvas(Sfrm)
cnva.grid(row=0, column=0, columnspan=2, sticky='NS')

sb=Scrollbar(Sfrm,orient='vertical',command=cnva.yview)
sb.grid(row=0,column=3,sticky='NS')

rollfrm=Frame(cnva)
rollfrm.grid(row=0, column=0, columnspan=2, sticky='NS')

rollfrm.bind('<Configure>',lambda e:cnva.configure(scrollregion=cnva.bbox('all')))
cnva.create_window((0,0),window=rollfrm,anchor='nw')
cnva.configure(yscrollcommand=sb.set)

root.mainloop()

0 个答案:

没有答案