title: tkinter how to divide frame into parts?
body: <p><a href="https://i.stack.imgur.com/1a1E3.jpg" rel="nofollow noreferrer">enter image description here</a>I am making tkinter gui program. In the program, When I clicked button, A pop-up is displayed.
  I want to divide pop-up frame into 9 buttons and display image in button.
  But in my code, The buttons are joined, not divided.
  Below is part of my code. I will wait for your help. Thank you.</p>
  
  <pre><code>  def create_window(self):
          window=Toplevel(root2)
          window.geometry("600x600")
          self.galleryframe=Frame(window)
          self.galleryframe.pack()
  
          self.topgframe=Frame(self.galleryframe,width=600,height=200)
          self.topgframe.pack()
  
          self.ibutton1=Button(self.topgframe,width=20,height=20)
          try:
              self.image1=PhotoImage(file="/home/som/imagefolder/1.png")
              self.ibutton1.config(image=self.image1)
              self.ibutton1.image=self.image1
          except TclError:
              pass
          self.ibutton1.pack(side=LEFT)
  
          self.ibutton2=Button(self.topgframe,width=20,height=20)
          try:
              self.image2=PhotoImage(file="/home/som/imagefolder/2.png")
              self.ibutton2.config(image=self.image2)
              self.ibutton2.image=self.image2
          except TclError:
              pass
          self.ibuttom2.pack()
  
          self.ibutton3=Button(self.topgframe,width=20,height=20)
          try:
              self.image3=PhotoImage(file="/home/som/imagefolder/3.png")
              self.ibutton3.config(image=self.image3)
              self.ibutton3.image=self.image3
          except TclError:
              pass
          self.ibuttom3.pack(side=RIGHT)
  
          self.midgframe=Frame(self.galleryframe,width=600,height=200)
          self.midgframe.pack()
  
          self.ibutton4=Button(self.midgframe,width=20,height=20)
          try:
              self.image4=PhotoImage(file="/home/som/imagefolder/4.png")
              self.ibutton4.config(image=self.image4)
              self.ibutton4.image=self.image4
          except TclError:
              pass
          self.ibuttom4.pack(side=LEFT)
  
        ....ibutton5-9 are almost same with upper things.
  </code></pre>