B
B
BrSein2016-02-27 13:03:01
Python
BrSein, 2016-02-27 13:03:01

tkinter. How to make a frame occupy the entire free area?

import tkinter as tk
root = tk.Tk()
root.maxsize(250,700)
root.minsize(250,150)
listFrame = tk.Frame(root, width = 250)
playerFrame = tk.Frame(root,width = 250, height=100)
listFrame.pack(side="top",fill = "both")
playerFrame.pack(side="bottom")
a = tk.Button(listFrame, text="bad")
b = tk.Button(playerFrame,text="good")
b.pack(side="top")
a.pack(side="bottom")
root.mainloop()

I have such a code and I need the listFrame to occupy the entire available area when the window is resized, how can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
cagey, 2016-03-12
@cagey

like this ?

import tkinter as tk
root = tk.Tk()
root.maxsize(250,700)
root.minsize(250,150)
listFrame = tk.Frame(root, width = 250, bg='green')  # цвет для наглядности
playerFrame = tk.Frame(root,width = 250, height=100)
listFrame.pack(fill="both", side="top", expand=True)
playerFrame.pack(side="bottom")
a = tk.Button(listFrame, text="bad")
a.pack(side="bottom")
b = tk.Button(playerFrame,text="good")
b.pack(side="top")
root.mainloop()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question