G_S 38 Junior Poster in Training

Hello people,


I am currently working on a program for comparing texts. Everything is working fine thanks to your help.

However, I would like to have my program resize everything when the player resizes the main Window. I have managed to do so, but something feels amiss...


Can you help me with this issue? Here is the code:

import os
import platform
import webbrowser
from tkinter import *
import tkinter.ttk
import tkinter.filedialog
import tkinter.messagebox

def yview(*args):
    t1.yview(*args)
    t2.yview(*args)

main = Tk()
main.title("My Program")

if platform.system() == "Linux":
    color="light blue"
    width1 = 30
    width2 = 60
    style = tkinter.ttk.Style()
    style.theme_use("clam")

elif platform.system() == "Windows":
    color="light blue"
    width1 = 50
    width2 = 55

mainframe = tkinter.ttk.Frame(main, relief=GROOVE)
secondframe = tkinter.ttk.Frame(mainframe)
l1 = tkinter.ttk.Label(secondframe, text="Some text")
e1 = tkinter.ttk.Entry(secondframe, width=width1)
b1 = tkinter.ttk.Button(secondframe, text="Button")
l2 = tkinter.ttk.Label(secondframe, text="Sometext")
e2 = tkinter.ttk.Entry(secondframe, width=width1)
b2 = tkinter.ttk.Button(secondframe, text="Button")
l3 = tkinter.ttk.Label(secondframe, text="List")
c1 = tkinter.ttk.Combobox(secondframe, width=width1-3)
l4 = tkinter.ttk.Label(secondframe, text="List")
c2 = tkinter.ttk.Combobox(secondframe, width=width1-3)
thirdframe = tkinter.ttk.Frame(secondframe)
s1 = Scrollbar(thirdframe, orient=VERTICAL)
t1 = tkinter.Text(thirdframe, background="white", wrap=WORD, undo=TRUE, width=width2, yscrollcommand=s1.set)
t2 = tkinter.Text(thirdframe, background="white", wrap=WORD, undo=TRUE, width=width2, yscrollcommand=s1.set)
l5 = tkinter.ttk.Label(thirdframe, text="TEXT")
e3 = tkinter.ttk.Entry(thirdframe, width=width1)
b3 = tkinter.ttk.Button(thirdframe, text="Button")
b4 = tkinter.ttk.Button(thirdframe, text="Button")
b5 = tkinter.ttk.Button(thirdframe, text="Close", command=main.destroy)

s1.config(command=yview)

mainframe.grid(row=0, column=0, padx=5, pady=5, sticky=N+S+W+E)
secondframe.grid(row=0, column=0, columnspan=6, padx=5, pady=5, sticky=N+S+W+E)
l1.grid(row=0, column=0, pady=10)
e1.grid(row=0, column=1, pady=10)
b1.grid(row=0, column=2, pady=10)
l2.grid(row=0, column=3, pady=10)
e2.grid(row=0, column=4, pady=10)
b2.grid(row=0, column=5, pady=10)
l3.grid(row=1, column=0, padx=5)
c1.grid(row=1, column=1)
l4.grid(row=1, column=3, padx=5)
c2.grid(row=1, column=4)
thirdframe.grid(row=2, column=0, columnspan=6, sticky=N+S+W+E)
t1.grid(row=0, column=0, columnspan=2, pady=10)
s1.grid(row=0, column=2, columnspan=2, sticky=N+S, padx=5)
t2.grid(row=0, column=4, columnspan=2, pady=10)
l5.grid(row=1, column=0)
e3.grid(row=1, column=1, columnspan=3, sticky=E+W)
b3.grid(row=1, column=4, columnspan=2, pady=10, padx=10, sticky=W+E)
b4.grid(row=2, column=0, columnspan=3, pady=10, padx=10, sticky=W+E)
b5.grid(row=2, column=3, columnspan=3, pady=10, padx=10, sticky=W+E)

main.columnconfigure(0, weight=8)
main.rowconfigure(0, weight=8)
mainframe.columnconfigure(0, weight=8)
mainframe.columnconfigure(1, weight=8)
mainframe.columnconfigure(2, weight=8)
mainframe.columnconfigure(3, weight=8)
mainframe.columnconfigure(4, weight=8)
mainframe.columnconfigure(5, weight=8)
mainframe.rowconfigure(0, weight=10)
mainframe.rowconfigure(1, weight=10)
mainframe.rowconfigure(2, weight=7)

secondframe.columnconfigure(0, weight=8)
secondframe.columnconfigure(1, weight=8)
secondframe.columnconfigure(2, weight=8)
secondframe.columnconfigure(3, weight=8)
secondframe.columnconfigure(4, weight=8)
secondframe.columnconfigure(5, weight=8)
secondframe.rowconfigure(0, weight=10)
secondframe.rowconfigure(1, weight=10)
secondframe.rowconfigure(2, weight=10)

thirdframe.columnconfigure(0, weight=8)
thirdframe.columnconfigure(1, weight=8)
thirdframe.columnconfigure(2, weight=8)
thirdframe.columnconfigure(3, weight=8)
thirdframe.columnconfigure(4, weight=8)
thirdframe.columnconfigure(5, weight=8)
thirdframe.rowconfigure(0, weight=8)
thirdframe.rowconfigure(1, weight=8)
thirdframe.rowconfigure(2, weight=8)

main.mainloop()

Remember it's Python 3.x.

Any suggestions (even if they have nothing to do with the question) are welcome.