How to Set a Tkinter Window With a Constant Size?
The task here is to produce a Tkinter window with a constant size. A window with a constant size cannot be resized as per users’ convenience, it holds its dimensions rigidly. A normal window on the other hand can be resized.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
- Import module
- Declare Tkinter object
- Create a fixed sized window using maxsize() and minsize() functions.
Here, height and width are in pixels.
In Tkinter, minsize() method is used to set the minimum size of the Tkinter window. Using this method a user can set window’s initialized size to its minimum size, and still be able to maximize and scale the window larger.
This method is used to set the maximum size of the root window. User will still be able to shrink the size of the window to the minimum possible.
Program 1: Creating a normal window
Program 2: Creating a window with constant size