[英]python Tkinter frame with both horizontal and vertical scrollbars
I'm trying to create a Frame within a Notebook that will scroll using the class code from https://lucasg.github.io/2015/07/21/How-to-make-a-proper-double-scrollbar-frame-in-Tkinter/我正在尝试在笔记本中创建一个框架,该框架将使用https://lucasg.github.io/2015/07/21/How-to-make-a-proper-double-scrollbar-frame 中的类代码滚动-in-Tkinter/
However, for whatever reason, when I make the window smaller than the content area (ScheduleMatrix is a ttk.Frame that contains a bunch of widgets), the scrollbars resize but remain inactive and unusable.但是,无论出于何种原因,当我使窗口小于内容区域时(ScheduleMatrix 是一个包含一堆小部件的 ttk.Frame),滚动条会调整大小但仍处于非活动状态且无法使用。 What am I missing?
我错过了什么? If it makes a difference, the widgets added to the ScheduleMatrix Frame are arranged using the grid geometry manager.
如果有所不同,添加到 ScheduleMatrix Frame 的小部件将使用网格几何管理器进行排列。
class BVSGUI(ttk.Frame):
def __init__(self, master):
ttk.Frame.__init__(self, master)
nb = ttk.Notebook(self)
nb.pack(expand=True, fill="both")
nb.enable_traversal()
p1 = ttk.Frame(nb)
p1.pack(expand=True, fill="both")
nb.add(p1, text='First Tab', underline=0)
ds1 = DoubleScrollbarFrame(p1)
ds1.pack(expand=True, fill="both")
m1 = ScheduleMatrix(ds1.canvas)
m1.pack(expand=True, fill="both")
p23 = ttk.Frame(nb)
p23.pack(expand=True, fill="both")
nb.add(p23, text='Tab 23', underline=0)
ds23 = DoubleScrollbarFrame(p23)
ds23.pack(expand=True, fill="both")
m23 = ScheduleMatrix(ds23.canvas)
m23.pack(expand=True, fill="both")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.