【发布时间】:2019-09-22 02:46:26
【问题描述】:
我的滚动条无法正确显示在我的 tkinter 笔记本中。我需要为每一页滚动
root = tk.Tk()
root.title('Client Intake Form')
n = ttk.Notebook(root)
f1 = ttk.Frame(n)
f2 = ttk.Frame(n)
f3 = ttk.Frame(n)
n.add(f1, text='Page 1', compound=tk.TOP)
n.add(f2, text='Page 2', compound=tk.TOP)
n.add(f3, text='Page 3', compound=tk.TOP)
n.pack()
canvas = tk.Canvas(f1, width=1000, height=1000, relief='raised')
canvas.pack()
scroll = tk.Scrollbar(canvas, command=canvas.yview, orient=tk.VERTICAL)
canvas.config(yscrollcommand=scroll.set, scrollregion=(1000,0,1000,1000))
scroll.pack(side=tk.RIGHT, fill=tk.Y, expand=True)
#######PAGE 2#######
page2 = tk.Canvas(f2, width=1000, height=1000, relief='raised')
page2.pack()
######PAGE 3######
page3 = tk.Canvas(f3, width=1000, height=1000, relief='raised')
page3.pack()
root.mainloop()
我想要每个页面右侧的滚动条。
【问题讨论】:
-
如果你想让它出现在所有页面上,为什么要把它放在画布里?
-
哦,我只是不知道怎么做,期间。或者放在哪里?但是,是的,我希望它出现在所有页面上。
标签: python canvas tkinter scrollbar