I have a piece of tkinter code running on python 3.4 that is a large frame placed in a canvas with a vertical scrollbar, however the scrollbar is grayed out and doesn\'t seem to
You must do three things when configuring a scrolling canvas:
yscrollcommand
attribute of the canvas to point to the scrollbarcommand
attribute of the scrollbarscrollregion
attribute of the canvasYou are neglecting to do #3. After adding the widgets to master_frame
you should do this:
self.canvas.configure(scrollregion=self.canvas.bbox("all")
The above will tell the canvas and scrollbar that the area of the canvas that is scrollable is the area that encompasses all of the objects on the canvas.
Finally, you need to remove the following line of code, because you are already adding the frame to the canvas with create_window
. Frames added to a canvas with pack
, place
or grid
won't scroll:
# remove this line
self.master_frame.grid()
For a working example of a scrollable frame, see Adding a scrollbar to a group of widgets in Tkinter