title: tkinter Canvas Scrollbar with Grid?
body: <p>Relatively new to Tkinter and Python. So kindly bear with me.</p>
  
  <p>I am trying to display the following GUI and want to have a scrollbar in Frame2 to display only 5x5 buttons at a time. Looks like Tkinter Frames don't support scrollbar and hence added a canvas (within which the frame is embedded) and a scrollbar in the parent frame 'FMas'. But for some reason the scroll bar goes to the right end of the screen and doesn't do any scrolling. </p>
  
  <p>Shouldn't the canvas end at the edge of the Frame2 and the scroll bar be right next to it? Also, I tried rowspan to increase the height of the scrollbar to match the height of 5x5 buttons. That too doesn't work.</p>
  
  <p><a href="https://i.stack.imgur.com/1I4Ye.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/1I4Ye.jpg" alt="enter image description here"></a></p>
  
  <p>CODE (Using Python3.2):</p>
  
  <pre><code>from tkinter import *
  import tkinter.ttk as ttk
  
  mGui = Tk()
  
  mGui.geometry("630x600")
  mGui.configure(background="Gray")
  
  mGui.columnconfigure(0, weight=1)
  mGui.rowconfigure(0, weight=1)
  
  FMas = Frame(mGui, bg="Gray")
  FMas.grid(sticky=(N,E,S,W))
  
  FMas.columnconfigure(0, weight=1)
  
  L1 = Label(FMas, text="Frame 1 Contents")
  L1.grid(row=0, column=0, pady=5, sticky=(N,W))
  
  F1 = Frame(FMas, bg="Green", bd=2, relief=GROOVE)
  F1.grid(row=1, column=0, sticky=(N,W))
  
  ChkBox1=IntVar()
  CB1 = Checkbutton(F1, text="StartCheckBox", variable=ChkBox1)
  CB1.grid(row=0,column=0,padx=2)
  
  L2 = Label(FMas, text="Frame 2 Contents")
  L2.grid(row=2, column=0, pady=5, sticky=(N,W))
  
  Can1 = Canvas(FMas, bg="Yellow")
  Can1.grid(row=3, column=0, sticky=(N,W))
  
  F2 = Frame(Can1, bg="Blue", bd=2, relief=GROOVE)
  F2.grid(row=0, column=0, sticky=(N,W))
  
  rows = 10
  for i in range(1,rows):
      for j in range(1,6):
          button = Button(F2, padx=7, pady=7, text="[%d,%d]" % (i,j))
          button.grid(row=i, column=j, sticky='news')
  
  vsbar = Scrollbar(FMas, orient="vertical", command=Can1.yview)
  vsbar.grid(row=3, column=1)
  
  Can1.configure(yscrollcommand=vsbar.set, scrollregion=Can1.bbox("all"))
  
  L3 = Label(FMas, text="Frame 3 Contents")
  L3.grid(row=4, column=0, pady=5, sticky=(N,W))
  
  F3 = Frame(FMas, bg="Red", bd=2, relief=GROOVE)
  F3.grid(row=5, column=0, sticky=(N,W))
  
  ChkBox2=IntVar()
  CB2 = Checkbutton(F3, text="EndCheckBox", variable=ChkBox2)
  CB2.grid(row=0,column=0,padx=2)
  
  mGui.mainloop()
  sys.exit()
  </code></pre>