简体   繁体   中英

Tkinter space between widgets keeps growing

I'm trying to get a paned widget to grow with a form but whenever I pull the window down vertically, the gap between the paned widget and the status bar grows.

from tkinter import *

root = Tk()

pw = PanedWindow(root, orient='horizontal')

red = LabelFrame(pw, text='red')
Label(red, text='something', anchor='w').grid(row=1, column=1)

blue = LabelFrame(pw, text='blue')
Label(blue, text='anything', anchor='w').grid(row=1, column=1)

pw.add(red, stretch='always')
pw.add(blue, stretch='always')

status = Label(root, text='Status', relief=SUNKEN)

pw.pack(expand=True, fill=BOTH)
status.pack(side=BOTTOM, expand=True, fill=X)

root.mainloop()

Is there a way of stopping the gap between the status bar and the bottom of the window and the gap between the status bar and the paned widget from growing?

To solve your issue I configured this line:

status.pack(side=BOTTOM, expand=False, fill=X,anchor='n')

For more information see .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM