title: Can I set the grid configuration before having any widget in Tkinter?
body: <p>Suppose I have a frame which contains 5 widgets and uses the <code>grid</code> method to manage positions:</p>
  
  <p><a href="https://i.stack.imgur.com/odByM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/odByM.png" alt="enter image description here"></a></p>
  
  <p>So far, so good. But what if I want now to make something like this (obtained using <em>bad</em> methods):</p>
  
  <p><a href="https://i.stack.imgur.com/tH83j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tH83j.png" alt="enter image description here"></a></p>
  
  <p>i.e. button <code>horizontal settings</code> spans 4 rows. If I were able to set grid configuration (say) in this manner: <code>grid(ncols = 1, nrows = 5)</code> and then I would do something like <code>button.columnconfigure(0,weight=4)</code> and <code>label.columnconfigure(0,weight=1)</code>.</p>
  
  <p>How to solve this problem?</p>
  
  <p>I will explain why this is not trivial question. It is because this two groups of widgets (on the 1st figure and on the 2nd) are in separate frames. So the first frame has 5 rows and the second has only 2. And widget will not be aligned: </p>
  
  <p><a href="https://i.stack.imgur.com/7QaPs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7QaPs.png" alt="enter image description here"></a></p>
  
  <p>EDIT:
  This is piece of my code:</p>
  
  <pre><code>class StartPage(tk.Frame):
  
    def __init__(self, parent, controller):
      tk.Frame.__init__(self, parent)
      self.controller = controller
  
      labelFrame = tk.Frame(self)
      labelFrame.pack(fill='x', side="top")
      startLabel = tk.Label(labelFrame, 
                            text="Start page")
      startLabel.pack(pady=10)
  
      quitFrame = tk.Frame(self)
      quitFrame.pack(fill='x',side="bottom")
      quitButton = tk.Button(quitFrame, text="Quit",
                             command=quit,
                             bg="pink")
      quitButton.pack(pady=10)
  
      operateFrame = tk.Frame(self)
      operateFrame.pack()
  
      channelGroup = tk.Frame(operateFrame) 
      channelGroup.grid(row=0, column=0, sticky = 'n')
      chLabel = tk.Label(channelGroup,
                         text="Channel group")
      chLabel.grid(pady=10)
  
      ch1Button = tk.Button(channelGroup, text="CH1 Settings",
                            command=lambda: controller.show_frame("CH1"))
      ch1Button.grid(row=1, column=0)
  
      ch2Button = tk.Button(channelGroup, text="CH2 Settings",
                            command=lambda: controller.show_frame("CH2"))
      ch2Button.grid(row=2, column=0)
  
      ch3Button = tk.Button(channelGroup, text="CH3 Settings",
                            command=lambda: controller.show_frame("CH3"))
      ch3Button.grid(row=3, column=0)
  
      ch4Button = tk.Button(channelGroup, text="CH4 Settings",
                            command=lambda: controller.show_frame("CH4"))
      ch4Button.grid(row=4, column=0)
  
  
      triggerGroup = tk.Frame(operateFrame)
      triggerGroup.grid(row=0, column=1, sticky='n')
      trigLabel = tk.Label(triggerGroup,
                           text="Trigger group")
      trigLabel.grid(row=0,column=0,pady=10)
      trigButton = tk.Button(triggerGroup, text="Trigger Settings",
                             command=lambda: controller.show_frame("Trigger"))
      trigButton.grid()
  
      horizGroup = tk.Frame(operateFrame)
      horizGroup.grid(row=0, column=2, sticky='n')
      horizLabel = tk.Label(horizGroup,
                            text="Horizontal group")
      horizLabel.grid(pady=10)
      horizButton = tk.Button(horizGroup,
                              text="Horizontal settings",
                              command=lambda: controller.show_frame("Horizontal"))
      horizButton.grid()
  </code></pre>
  
  <p>After that I get:</p>
  
  <p><a href="https://i.stack.imgur.com/0MQbm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0MQbm.png" alt="enter image description here"></a></p>