Prerequisite: Tkinter
Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applications.
In this article, we will learn how to make a window resizer control panel that is used to resize the window size once it is initialized.
Approach:
- We will create two windows; one window is a parent and another one is a child.
 - Add one button; when we click on a button it will open the child window.
 - The parent window contains three sliders; width, height, and both sliders.
 - As the slide value change, child geometry will change.
 
Let’s understand step by step implementation:-
Step 1: Create a Normal Tkinter window
Python3
# Import Libraryfrom tkinter import *# Create Objectroot = Tk()# Set titleroot.title("Controls")# Set Geometryroot.geometry("400x500")# Execute Tkinterroot.mainloop() | 
Output:
Step 2: Add Button, Sliders & LabelFrame
Python3
# Import Libraryfrom tkinter import *from tkinter import ttk# Create Objectroot = Tk()# Set titleroot.title("Controls")# Set Geometryroot.geometry("400x500")# Make Buttonlaunch_button = Button(root,                       text = "launch Window")launch_button.pack(pady = 10)# Add Label Frameswidth_frame = LabelFrame(root,                         text = "Change width")width_frame.pack(pady = 10)height_frame = LabelFrame(root,                          text = "change height")height_frame.pack(pady = 10)both_frame = LabelFrame(root,                        text = "change both")both_frame.pack(pady = 10)# Add Scale barwidth_slider = ttk.Scale(width_frame,                         from_ = 100,                         to = 500,                         orient = HORIZONTAL,                         length = 200, value = 100)width_slider.pack(pady = 10, padx = 20)height_slider = ttk.Scale(height_frame,                          from_ = 100, to = 500,                          orient = VERTICAL,                           length = 200, value = 100)height_slider.pack(pady = 10, padx = 20)both_slider = ttk.Scale(both_frame, from_ = 100,                        to = 500, orient = HORIZONTAL,                        length = 200, value = 100)both_slider.pack(pady = 10,padx = 20)# Execute Tkinterroot.mainloop() | 
Output:-
Step 3: Now we will create four functions; one function is for a button that will open the child window, and the other three for changing the geometry.
Use the Toplevel() method to create a child window.
Python3
# Open New Windowdef launch():    global second    second = Toplevel()    second.geometry("100x100")# Change widthdef width_slide(x):    second.geometry(f"{int(width_slider.get())}x{int(height_slider.get())}")# Change heightdef height_slide(x):    second.geometry(f"{int(width_slider.get())}x{int(height_slider.get())}")# Change both width and heightdef both_slide(x):    second.geometry(f"{int(both_slider.get())}x{int(both_slider.get())}") | 
Below is the full implementation:
Python3
# Import Libraryfrom tkinter import *from tkinter import ttk# Create Objectroot = Tk()# Set titleroot.title("Controls")# Set Geometryroot.geometry("400x500")# Open New Windowdef launch():    global second    second = Toplevel()    second.geometry("100x100")# Change widthdef width_slide(x):    second.geometry(f"{int(width_slider.get())}x{int(height_slider.get())}")# Change heightdef height_slide(x):    second.geometry(f"{int(width_slider.get())}x{int(height_slider.get())}")# Change both width and heightdef both_slide(x):    second.geometry(f"{int(both_slider.get())}x{int(both_slider.get())}")# Make Buttonlaunch_button = Button(root,                       text = "launch Window",                       command = launch)launch_button.pack(pady = 10)# Add Label Frameswidth_frame = LabelFrame(root,                         text = "Change width")width_frame.pack(pady = 10)height_frame = LabelFrame(root,                          text = "change height")height_frame.pack(pady = 10)both_frame = LabelFrame(root,                         text = "change both")both_frame.pack(pady = 10)# Add Scale barwidth_slider = ttk.Scale(width_frame,from_ = 100, to = 500,                         orient = HORIZONTAL, length = 200,                         command = width_slide,                         value = 100)width_slider.pack(pady = 10, padx = 20)height_slider = ttk.Scale(height_frame, from_ = 100, to = 500,                          orient = VERTICAL, length = 200,                          command = height_slide,                          value = 100)height_slider.pack(pady = 10, padx = 20)both_slider = ttk.Scale(both_frame, from_ = 100,to = 500,                        orient = HORIZONTAL, length = 200,                        command = both_slide, value = 100)both_slider.pack(pady = 10, padx = 20)# Execute Tkinterroot.mainloop() | 
Output:

                                    