I want to make a window which enables split text screens in Tkinter. I also want to be able to "stretch" the screens with the mouse, so for example if I want one of the screens to be temporarily bigger than the other, I just drag it with the mouse.
I thought I could put a Text widget inside a PanedWindow widget since I thought the PanedWindow widget always is stretchable, but my code doesn't quite do the job. I'm able to get split screens, but they aren't stretchable. Here Is my (Unnecessary long but simple) code so far:
from Tkinter import *
root = Tk()
# Seems strange to column- and rowconfigure the root but if I don't -
# the text widgets won't resize at all
for i in range(4):
root.columnconfigure(0, weight=1)
for i in range(1,3):
root.rowconfigure(1, weight=1)
# make a master PanedWindow
m1 = PanedWindow(root)
m1.grid(column=0, row=0, rowspan=4, columnspan=4, sticky=E+N+W+S)
for i in range(4):
m1.columnconfigure(i, weight=1) # Enable vertical resizing
for i in range(1,3):
m1.rowconfigure(i, weight=1) #Enable horizontal resizing
# make a PanedWindow inside m1, positioned to the left
m2=PanedWindow(m1)
m2.grid(column=0, row=1, columnspan=2, rowspan=2, sticky=E+N+W+S)
for i in range(2):
m2.columnconfigure(i, weight=1) # Enable vertical resizing
for i in range(1,3):
m2.rowconfigure(i, weight=1) #Enable horizontal resizing
# make another PanedWindow inside m1, positioned to the right
m3=PanedWindow(m1)
m3.grid(column=2, row=1, columnspan=2, rowspan=2, sticky=E+N+W+S)
for i in range(2, 4):
m3.columnconfigure(i, weight=1) # Enable vertical resizing
for i in range(1,3):
m3.rowconfigure(i, weight=1) #Enable horizontal resizing
# Add a text widget in m2
text1 = Text(m2, height=15, width =15)
m2.add(text1)
# Add another textwidget in m3
text2=Text(m3, height=15, width=15)
m3.add(text2)
root.mainloop()