title: Why is my tkinter toplevel huge when I stated size constraints?
body: <p>I'm aware this is probably a newb question, but I have yet to be able to find an answer. Here's a snippet of my code, that has a root window containing a button to open a Toplevel. The Toplevel pulls a random line from a text file to function as a sort of idea generator.</p>
  <pre><code>import random, fileinput
  import tkinter as tk
  from tkinter import *
  
  root = tk.Tk()
  root.title('Daydreamer')
  #fname should be the file name of the image in working directory
  fname = &quot;bg.gif&quot;
  bg_image = tk.PhotoImage(file=fname)
  
  #get width and height of image
  w = bg_image.width()
  h = bg_image.height()    
  
  #size window correctly
      root.geometry(&quot;500x400&quot;)
      cv = tk.Canvas(width=w, height=h)
      cv.pack(side='top', fill='both', expand='yes')
      cv.create_image(0,0,image=bg_image,anchor='nw')
      
      #add a frame for text
      mainframe=tk.Frame(root)
      
      #new window for inspirations
      def inspirations():
          top = Toplevel(root)
          top.geometry=(&quot;100x100&quot;)
          top.title(&quot;Inspiration&quot;)
          def idea():
              textidea=None
              for line in fileinput.input('textlist.txt'):
                  if random.randrange(fileinput.lineno())==0:
                      textidea=line
              entrytext=tk.Text(top)
              entrytext.insert(INSERT, textidea)
              entrytext.insert(END, &quot;Or press the Inspire Me button again for another idea!&quot;)
              entrytext.pack()
          idea()
              
   
  
             top.mainloop()
      
     
   
     
      #add buttons
      btn1 = tk.Button(cv, text=&quot;Inspire Me&quot;, command=inspirations)
      btn1.pack(side='left', padx=10, pady=5, anchor='sw')
      
      root.mainloop()
  </code></pre>
  <p>Problem is, that Toplevel always comes out absolutely huge (larger than my root window), which looks incredibly silly for the small amount of content being displayed in it. Am I missing something really minute and stupid here? Help much appreciated.</p>