title: My tkinter window with a scrollbar is lagging
body: <p>I want to preface this by saying I'm not as good at python as many of you are. I don't know how classes work for example. But I know all the basics and some specifics.</p>
  <p>Anyway the issue I'm currently having is that I have a window with many checkboxes and a scrollbar, and when I scroll down it lags heavily. Here's some photos:</p>
  <p><a href="https://i.stack.imgur.com/BT4kW.png" rel="nofollow noreferrer">Photo of the window</a></p>
  <p><a href="https://i.stack.imgur.com/sEKcb.png" rel="nofollow noreferrer">Photo of the window when I scroll</a></p>
  <p>The lag goes away, it just takes a few moments.</p>
  <p>Here's the code:</p>
  <pre><code>from tkinter import *
  
  root = Tk()
  vscrollbar = Scrollbar(root)
  c = Canvas(root,yscrollcommand=vscrollbar.set)
  vscrollbar.config(command=c.yview)
  vscrollbar.pack(side=LEFT, fill=Y)
  f=Frame(c)
  c.pack(side=&quot;left&quot;, fill=&quot;both&quot;, expand=True)
  c.create_window(0,0,window=f, anchor='nw')
  # creates the variables that store the values of the checkboxes
  job_dictionary = {}
  with open(&quot;jobs.txt&quot;,&quot;r&quot;) as file:
      for line in file:
          job_dictionary[line.replace(&quot;\n&quot;,&quot;&quot;)] = IntVar()
  # row_ and column_ are used to determine the grid placement of all the checkbuttons.
  row_ = 2
  column_ = 0
  for line in sorted(job_dictionary.keys()):
      Checkbutton(f, text=line.replace(&quot;\&quot;&quot;,&quot;&quot;), variable=job_dictionary[line]).grid(row=row_, column=column_, sticky=W)
      row_ += 1
      if row_ &gt; 60:
          row_ = 2
          column_ += 1
  root.update()
  c.config(scrollregion=c.bbox(&quot;all&quot;))
  
  root.mainloop()
  </code></pre>
  <p>The values for each checkbox is stored as a value in a dictionary. <code>row_</code> and <code>column_</code> are used to determine the placement of each checkbox within the frame. The code to use a scrollbar and a frame at the same time was taken from <a href="https://stackoverflow.com/questions/42237310/tkinter-canvas-scrollbar">here</a>.</p>