0

I am working on a simple tkinter gui- one panedwindow and two frames inside it. The resizing is working fine. The problem is that when I add the second frame to the same panedwindow, it takes up all the space as shown in the image. Is there a way to set a default size for the child frames in the panedwindow and still be able to resize them using sash? I tried setting height using paneconfigure but it doesn't help. Any pointers are welcome. I just want frame2 to have a smaller height than frame1 initially.

pw = tk.PanedWindow(root, orient="vertical", sashpad=1)
pw.pack(fill=tk.BOTH, expand=1)
frame1= tk.Frame(pw, bg="#CFD8DC")
frame2 = tk.Frame(pw, bg="#fafafa")
pw.add(frame1)
pw.add(frame2)

enter image description here

user3840530
  • 290
  • 1
  • 4
  • 14
  • 1
    It would be a lot easier to test solutions for you if you provide a [mcve]. – Novel Jul 03 '18 at 02:21
  • 1
    Why use `paneconfigure`? You can set the height as you add it: `pw.add(frame1, height=400)`. That works for me. – Novel Jul 03 '18 at 02:24
  • @Novel Thanks! I was working pretty late and stupidly missed the height parameter in add function. It works! If you can make that an answer, I will mark it. – user3840530 Jul 03 '18 at 08:37

1 Answers1

1

"pw.add(frame1, height=400)" This line doesn't work for me, but anyway I found the solution with your message I'm using "pw.add(frame1, weight=1)" and "pw.add(frame2, weight=3)" lines to give initial size for paned frames.