title: How to fit Tkinter listbox to contents
body: <p>I'm adding strings to a listbox using the code below. When I run the code and the window opens, the longer strings get clipped as the window is not large enough (see screenshot). I have tried making the window resizeable and adding scroll bars but I was wondering if there was a way to automatically size it to fit the content.</p>
  
  <pre class="lang-py prettyprint-override"><code>master = tk.Tk()
  listbox = tk.Listbox(master, selectmode=tk.SINGLE)
  
  games = ["Garry's Mod", "Mount and Blade: Warband", "Tekkit"]
  for game in sorted(games):
      listbox.insert(tk.END, game)
  
  button = tk.Button(master, text="Execute", command=execute)
  
  listbox.pack()
  button.pack()
  tk.mainloop()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/j9vMJ.png" alt="example of clipped listbox"></p>