I want to create the main window with a horizontal scroll bar at the bottom.
This main window then should contain an uncertain number of smaller text widgets with vertical scrollbars.
The code below packs 10 scrolled text widgets into a larger text widget.
My problem is "attempt one" used window_frame.pack(side="left", fill="both", expand=True) to place the text widgets. This gave me the desired height (full screen) but I lost the use of the horizontal scrollbar and all ten widgets are not viewable.
In attempt two I used text_box.window_create("1.0", window=window_frame) the horizontal scrollbar works and I can view all 10 text widgets but I can't figure out how to make them fill the screen on the vertical axis.
Is there any way of achieving the horizontal scroll feature and have the text widgets at fullscreen height (without measuring font size)?
Or am I going about this in entirely the wrong way?
Here is a workable and simplified version of the problem. Just hit Escape to destroy the window.
import tkinter as tk
from tkinter import ttk
import tkinter.scrolledtext as St
root = tk.Tk()
root.bind("<Escape>", exit)
root.wm_attributes("-fullscreen", True)
#Mother Text Box to hold the windows
f = tk.Frame(root, background = "black")
f.pack(fill="both", expand=True)
vbar = ttk.Scrollbar(f, orient="horizontal")
text_box = tk.Text(f, xscrollcommand=vbar.set, wrap=tk.NONE, border=0, borderwidth=0)
text_box.pack(fill="both", expand=1)
vbar.pack(fill="x", side="bottom", pady=0)
vbar.config(command=text_box.xview)
window_frame = tk.Frame(text_box, background="yellow")
# This is attempt one #
#window_frame.pack(side="left", fill="both", expand=True)
# This is attempt two #
text_box.window_create("1.0", window=window_frame)
window_frame.configure(pady=2, padx=2)
text_box_list = []
for n in range(0, 10):
text_box_list.append(St.ScrolledText(window_frame))
text_box_list[n].pack(side="left", fill="both", expand=True)
root.mainloop()
def exit(root, event):
root.destroy()