请看我的课,那是一个可滚动的框架。它的垂直滚动条被绑定到事件也是。所以,您所要做的就是创建一个框架,按照您喜欢的方式填充它,然后使这个框架成为我的一个子框架。ScrolledWindow.scrollwindow..如果有什么不清楚的地方,可以随意问一问。
大量使用@Brayan Oakley的答案来接近这个问题class ScrolledWindow(tk.Frame):
"""
1. Master widget gets scrollbars and a canvas. Scrollbars are connected
to canvas scrollregion.
2. self.scrollwindow is created and inserted into canvas
Usage Guideline:
Assign any widgets as children of .scrollwindow
to get them inserted into canvas
__init__(self, parent, canv_w = 400, canv_h = 400, *args, **kwargs)
docstring:
Parent = master of scrolled window
canv_w - width of canvas
canv_h - height of canvas
"""
def __init__(self, parent, canv_w = 400, canv_h = 400, *args, **kwargs):
"""Parent = master of scrolled windo