First time with TkInter. According to what I've read, you can use Frame widgets to hold other widgets. So, I laid down some preview Frames as such:
import tkinter as tk
root = tk.Tk()
TextFrame = tk.Frame(root, width=200, height=600, bg="red")
TextFrame.pack(side="left")
ListFrame = tk.Frame(root, width=800, height=600, bg="blue")
ListFrame.pack(side="right")
However, when I add a widget and tell it to fill the Frame, it simply replaces the frame instead of expanding to fill the area. Test code used:
ListBox = tk.Listbox(ListFrame, selectmode="single", bg="#545454", fg="#d9d9d9")
for X in range(20):
ListBox.insert('end', X)
ListBox.pack(fill='both', expand=True)
The same test code expands properly if I set the parent to the main 'root' object. Example:
import tkinter as tk
root = tk.Tk()
root.geometry("1000x600")
ListBox = tk.Listbox(root, selectmode="single", bg="#545454", fg="#d9d9d9")
for X in range(20):
ListBox.insert('end', X)
ListBox.pack(side="right", fill='both', expand=True)
TextBox = tk.Message(root, text="A bunch of text", width=100)
TextBox.pack(side="left", fill="y")
Am I doing something wrong, here?