如何在tkinter窗口或框架小部件上添加滚动条?

时间:2020-07-23 12:45:47

标签: python tkinter scrollbar

我想将滚动条添加到tkinter的主窗口或仅在画布,列表或文本小部件上的Frame Widget上。 我已经尝试过了:

main_two=Toplevel()
main_two.title("TGZ Youtube Video Downloader")
main_two.iconbitmap("Bin/TGZ_icon.ico")
main_two.geometry("500x500+430+50")
main_two.resizable(0, 0)
# Scrollbar
scrollbar = ttk.Scrollbar(main_two, command=main_two.yview, orient=VERTICAL)
scrollbar.config(command=main_two.yview)
main_two.configure(yscrollcommand=scrollbar.set)
scrollbar.place(x=455, y=0, height=450)

但出现此错误:

AttributeError: 'Toplevel' object has no attribute 'yview'

0 个答案:

没有答案
相关问题