title: Tkinter Grid: How to position widgets so they are not stuck together
body: <p>I'm trying to create two Label widgets that are in the top left and top right corners of my test UI. The problem is that the widgets are stuck together and I'd like there to be space between them.</p>
  
  <p>In my research, I came across suggestions to use the sticky, padx, and pady options. But no matter what arguments I pass to .grid() , I can't seem to be able to create space between my widgets. I understand that regardless of the number of columns and rows between two widgets, if said rows/columns are empty, then its as if they didn't exist and the widgets appear glued together.</p>
  
  <p>Using the .grid() method, how can I position widgets so that they aren't stuck together?</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>#!/usr/bin/python
  from Tkinter import *
  
  class MyApp:
      def __init__(self, parent):
          self.myParent = parent
          self.main_container = Frame(parent)
          self.main_container.grid(row=0, rowspan=2, column=0, columnspan=4)
  
          self.top_frame = Frame(self.main_container)
          self.top_frame.grid(row=0, column=0, columnspan=4)
  
          self.top_left = Frame(self.top_frame)
          self.top_left.grid(row=0, column=0, columnspan=2)
  
          self.top_right = Frame(self.top_frame)
          self.top_right.grid(row=0, column=2, columnspan=2)
  
          self.bottom_frame = Frame(self.main_container)
          self.bottom_frame.grid(row=2, column=0, columnspan=4)
  
          self.top_left_label = Label(self.top_left, text="Top Left")
          self.top_left_label.grid(row=0, column=0, sticky='W', padx=2, pady=2)
  
          self.top_right_label = Label(self.top_right, text="Top Right")
          self.top_right_label.grid(row=0, column=4, sticky='E', padx=2, pady=2)
  
          self.text_box = Text(self.bottom_frame, height=5, width=40)
          self.text_box.grid(row=0, column=0)
  
  root = Tk()
  root.title("Test UI")
  myapp = MyApp(root)
  root.mainloop()
  </code></pre>
  
  <p>~<em>~Update~</em>~</p>
  
  <p>I tried the following but it did not work:</p>
  
  <pre><code>    self.top_left = Frame(self.top_frame)
      self.top_left.grid(row=0, column=0, columnspan=2)
      for c in range(2):
          self.top_left.columnconfigure(c, weight=2)
  
      self.top_right = Frame(self.top_frame)
      self.top_right.grid(row=0, column=2, columnspan=2)
      for c in range(2):
          self.top_right.columnconfigure(c, weight=2)
  </code></pre>