相关代码:相关代码:相关代码:相关代码:相关代码:相关代码:相关代码:相关代码:相关代码:相关代码:相关代码:相关代码:
self.propertyListWrapper = ttk.Frame(self.propertyMenu)
self.propertyListWrapper.pack( fill = tk.BOTH, expand = tk.YES )
self.propertyListCanvas = tk.Canvas(self.propertyListWrapper)
self.propertyListCanvas.pack( fill = tk.BOTH, expand = tk.YES, side = tk.LEFT )
self.propertyGrid = ttk.Frame(self.propertyListCanvas)
self.propertyListScrollbar = ttk.Scrollbar(self.propertyListWrapper)
self.propertyListScrollbar.config(command =
self.propertyListCanvas.yview)
self.propertyListCanvas.config(yscrollcommand =
self.propertyListScrollbar.set)
self.propertyListScrollbar.pack(side = tk.RIGHT, fill = tk.Y)
self.propertyListCanvas.config( scrollregion = (0, 0,
self.propertyGrid.winfo_width(), self.propertyGrid.winfo_height()))
self.propertyListCanvas.create_window((0,0), window = self.propertyGrid, anchor='nw')
答案 0 :(得分:0)
要使画布能够滚动框架,必须使用create_window
方法将框架添加到画布中。您无法使用pack
。