title: Tkinter button placement (best practice)
body: <p>I have written some tkinter code which places a few checkbuttons into separate frames. It has two issues:</p>
  <ol>
  <li>It is very unelegant! Any suggestions to do it better?</li>
  <li>The frames do not have the same size. I tried to fix the size of the frames with the arguments <code>width</code> and <code>height</code> instead using padding but this does not work.</li>
  </ol>
  <pre><code>import tkinter as tk
  from tkinter import *
  
  root = tk.Tk()
  
  frames = [tk.Frame(master=root, relief = RAISED ,padx = 20, pady = 20, borderwidth = 2) for _ in range(16)]
  
  frames[0].grid(row = 0, column = 0)
  frames[1].grid(row = 0, column = 1)
  frames[2].grid(row = 0, column = 2)
  frames[3].grid(row = 0, column = 3)
  frames[4].grid(row = 1, column = 0)
  frames[5].grid(row = 1, column = 1)
  frames[6].grid(row = 1, column = 2)
  frames[7].grid(row = 1, column = 3)
  frames[8].grid(row = 0, column = 4)
  frames[9].grid(row = 0, column = 5)
  frames[10].grid(row = 0, column = 6)
  frames[11].grid(row = 0, column = 7)
  frames[12].grid(row = 1, column = 4)
  frames[13].grid(row = 1, column = 5)
  frames[14].grid(row = 1, column = 6)
  frames[15].grid(row = 1, column = 7)
  
  Checkbuttons = {}
  checkbuttonBooleans = {}
  placementIndex = [0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15]
  
  i = 0
  for channel in range(64):
      checkbuttonBooleans[channel] = tk.BooleanVar()
      Checkbuttons[channel] = tk.Checkbutton(master = frames[placementIndex[channel]], text = str(channel), variable = checkbuttonBooleans[channel]).grid(row = 0 + i, column = 0 , sticky = W)
      i += 1
  
      if i==4:
          i = 0
  
  root.mainloop()
  </code></pre>