Python Tkinter Window or Canvas Resizer to Custom Width and Height GUI Desktop App Full Project For Beginners

Python Tkinter Window or Canvas Resizer to Custom Width and Height GUI Desktop App Full Project For Beginners

 

Welcome folks today in this blog post we will be building a window resizer desktop app in tkinter using python. All the full source code of application is given below.

 

 

Get Started

 

 

In order to get started you need make an app.py file and copy paste the following code

 

app.py

 

from tkinter import *

root = Tk()
root.geometry("250x200")
def resize():
    width_value = width.get()
    height_value = height.get()
    root.geometry(f"{width_value}x{height_value}")

root.title("Window Resizer")    #window title
Label(text="Window Resizer", font="comicsansms 11 bold", pady=20).grid(column=2)    #heading

Label(text="Width: ", font="comicsansms 11").grid(row=1, column=1)      #Name1
Label(text="Height: ", font="comicsansms 11").grid(row=2, column=1)     #name2

#create stringvar()
width = StringVar()
height = StringVar()

width_entry = Entry(root, textvariable=width).grid(row=1, column=2)
height_entry = Entry(root, textvariable=height).grid(row=2, column=2)

Button(text="Apply", command=resize, pady=2, font="comicsansms 11").grid(row=4,column=2)

root.mainloop()

 

 

So now if you execute the app.py file and execute the below command

 

python app.py

 

 

So as you can see we have the form where we can submit the custom width and height and then it will automatically resize the window or canvas to that width and height

Leave a Reply