The Wayback Machine - https://web.archive.org/web/20240914051715/https://www.geeksforgeeks.org/resizable-method-in-tkinter-python/
Open In App

resizable() method in Tkinter | Python

Last Updated : 15 Apr, 2019
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

resizable() method is used to allow Tkinter root window to change it’s size according to the users need as well we can prohibit resizing of the Tkinter window.
So, basically, if user wants to create a fixed size window, this method can be used.

How to use:

-> import tkinter
-> root = Tk()
-> root.resizable(height = None, width = None)

Arguments to be passed:

-> In resizable() method user can pass either positive integer or True, to make the window resizable.
-> To make window non-resizable user can pass 0 or False.

Code #1: Allowing root window to change it’s size




# importing only  those functions
# which are needed
from tkinter import * 
from tkinter.ttk import * 
from time import strftime
  
# creating tkinter window
root = Tk()
root.title('Resizable')
root.geometry('250x100')
  
Label(root, text = 'It\'s resizable').pack(side = TOP, pady = 10)
  
# Allowing root window to change
# it's size according to user's need
root.resizable(True, True)
  
mainloop()


Output:

Initial size – You may observe that the part inside blue circle is enabled i.e window is resizable and can be expanded. After resizing still the part inside the blue is enabled so you can still change the size of the window.

Code #2: Restricting root window to change it’s size (fixed size window).




# importing only  those functions
# which are needed
from tkinter import * 
from tkinter.ttk import * 
from time import strftime
  
# creating tkinter window
root = Tk()
root.title('Resizable')
root.geometry('250x100')
  
Label(root, text = 'It\'s non-resizable').pack(side = TOP, pady = 10)
  
# Restricting root window to change
# it's size according to user's need
root.resizable(0, 0)
  
mainloop()


Output:

You may observe that the part inside the blue circle is disabled i.e size of the window cannot be altered.



Previous Article
Next Article

Similar Reads

Difference Between The Widgets Of Tkinter And Tkinter.Ttk In Python
Python offers a variety of GUI (Graphical User Interface) frameworks to develop desktop applications. Among these, Tkinter is the standard Python interface to the Tk GUI toolkit. Tkinter also includes the 'ttk' module, which enhances the visual appeal and functionality of the applications. In this article, we will cover the differences, providing a
4 min read
PYGLET – Getting Window Resizable Property
In this article we will see how we can get the window resizable property in PYGLET module in python. Pyglet is easy to use but powerful library for developing visually rich GUI applications like games, multimedia etc. A window is a "heavyweight" object occupying operating system resources. Windows may appear as floating regions or can be set to fil
2 min read
Geometry Method in Python Tkinter
Tkinter is a Python module that is used to develop GUI (Graphical User Interface) applications. It comes along with Python, so you do not have to install it using the pip command. Tkinter provides many methods, one of them is the geometry() method. This method is used to set the dimensions of the Tkinter window and is used to set the position of th
3 min read
Python | after method in Tkinter
Tkinter provides a variety of built-in functions develop interactive and featured GUI (Graphical User Interface). after() function is also a Universal function which can be used directly on the root as well as with other widgets. after(parent, ms, function = None, *args) Parameters: parent: is the object of the widget or main window whichever is us
2 min read
minsize() method in Tkinter | Python
In Tkinter, minsize() method is used to set the minimum size of the Tkinter window. Using this method user can set window's initialized size to its minimum size, and still be able to maximize and scale the window larger. Syntax: master.minsize(width, height) Here, height and width are in pixels. Code #1: Root window without minimum size that means
2 min read
maxsize() method in Tkinter | Python
This method is used to set the maximum size of the root window (maximum size a window can be expanded). User will still be able to shrink the size of the window to the minimum possible. Syntax : master.maxsize(height, width) Here, height and width are in pixels. Code #1: C/C++ Code # importing only those functions # which are needed from tkinter im
2 min read
destroy() method in Tkinter | Python
Tkinter supports a variety of methods to perform various tasks. It also offers some universal method. destroy() is a universal widget method i.e we can use this method with any of the available widgets as well as with the main tkinter window. Syntax: widget_object = Widget(parent, command = widget_class_object.destroy) This method can be used with
2 min read
iconphoto() method in Tkinter | Python
iconphoto() method is used to set the titlebar icon of any tkinter/toplevel window. But to set any image as the icon of titlebar, image should be the object of PhotoImage class.Syntax: iconphoto(self, default = False, *args) Steps to set icon image - from tkinter import Tk master = Tk() photo = PhotoImage(file = "Any image file") master.iconphoto(F
2 min read
Python | forget_pack() and forget_grid() method in Tkinter
If we want to unmap any widget from the screen or toplevel then forget() method is used. There are two types of forget method forget_pack() ( similar to forget() ) and forget_grid() which are used with pack() and grid() method respectively. forget_pack() method - Syntax: widget.forget_pack() widget can be any valid widget which is visible. Code #1:
3 min read
Python Tkinter | Moving objects using Canvas.move() method
The Canvas class of Tkinter supports functions that are used to move objects from one position to another in any canvas or Tkinter top-level. Syntax: Canvas.move(canvas_object, x, y)Parameters: canvas_object is any valid image or drawing created with the help of Canvas class. To know how to create object using Canvas class take reference of this. x
2 min read
Python | place() method in Tkinter
The Place geometry manager is the simplest of the three general geometry managers provided in Tkinter. It allows you explicitly set the position and size of a window, either in absolute terms, or relative to another window. You can access the place manager through the place() method which is available for all standard widgets. It is usually not a g
3 min read
Python | pack() method in Tkinter
The Pack geometry manager packs widgets relative to the earlier widget. Tkinter literally packs all the widgets one after the other in a window. We can use options like fill, expand, and side to control this geometry manager.Compared to the grid manager, the pack manager is somewhat limited, but it’s much easier to use in a few, but quite common si
3 min read
Python Tkinter | grid_location() and grid_size() method
Tkinter is used to develop GUI (Graphical User Interface) applications. It supports a variety of widgets as well as a variety of widgets methods or universal widget methods. grid_location() method - This method returns a tuple containing (column, row) of any specified widget. Since this method is a widget method you cannot use it with master object
3 min read
Place_forget() method using Tkinter in Python
To hide or forget a widget from the parent widget or screen in tkinter, the place_forget() method is used on that widget based on place geometry management. Syntax: widget.place_forget() Parameter: NoneReturn: None Below is the implementation : C/C++ Code # Imports everything from tkinter # and ttk module from tkinter import * from tkinter.ttk impo
1 min read
Python | grid() method in Tkinter
The Grid geometry manager puts the widgets in a 2-dimensional table. The master widget is split into a number of rows and columns, and each “cell” in the resulting table can hold a widget. The grid manager is the most flexible of the geometry managers in Tkinter. If you don’t want to learn how and when to use all three managers, you should at least
6 min read
Tkinter - bell() method
Prerequisite: Python GUI – tkinter Python offers multiple options for developing 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 the GUI applications. Creatin
1 min read
Difference Between "Fill" and "Expand" Options for Tkinter Pack Method
Efficient layout management is crucial in creating visually appealing and user-friendly graphical user interfaces (GUIs). In the world of Python GUI programming, Tkinter stands out as a popular choice due to its simplicity and versatility. One of the key techniques used in Tkinter for layout management is the Pack method. In this article, we'll del
4 min read
Python | askopenfile() function in Tkinter
While working with GUI one may need to open files and read data from it or may require to write data in that particular file. One can achieve this with the help of open() function (python built-in) but one may not be able to select any required file unless provides a path to that particular file in code. With the help of GUI, you may not require to
2 min read
Python | Binding function in Tkinter
Tkinter is a GUI (Graphical User Interface) module that is widely used in desktop applications. It comes along with the Python, but you can also install it externally with the help of pip command. It provides a variety of Widget classes and functions with the help of which one can make our GUI more attractive and user-friendly in terms of both look
3 min read
Color game using Tkinter in Python
TKinter is widely used for developing GUI applications. Along with applications, we can also use Tkinter GUI to develop games. Let's try to make a game using Tkinter. In this game player has to enter color of the word that appears on the screen and hence the score increases by one, the total time to play this game is 30 seconds. Colors used in this
4 min read
Python | Message Encode-Decode using Tkinter
Prerequisite : Basics of TkinterPython offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with tkinter outputs the fastest and easiest way to create the GUI applications. Python pr
5 min read
Python - Tkinter askquestion Dialog
In Python, There Are Several Libraries for Graphical User Interface. Tkinter is one of them that is most useful. It is a standard interface. Tkinter is easy to use and provides several functions for building efficient applications. In Every Application, we need some Message to Display like "Do You Want To Close " or showing any warning or Something
4 min read
Simple registration form using Python Tkinter
Prerequisites: Tkinter Introduction, openpyxl module.Python provides the Tkinter toolkit to develop GUI applications. Now, it’s upto the imagination or necessity of developer, what he/she want to develop using this toolkit. Let's make a simple information form GUI application using Tkinter. In this application, User has to fill up the required info
5 min read
Python | Simple GUI calculator using Tkinter
Prerequisite: Tkinter Introduction, lambda function 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 outputs the fastest and easiest way to create GUI a
6 min read
Python | Distance-time GUI calculator using Tkinter
Prerequisites : Introduction to Tkinter | Using google distance matrix API Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with tkinter outputs the fastest and easiest wa
7 min read
Python | Random Password Generator using Tkinter
With growing technology, everything has relied on data, and securing this data is the main concern. Passwords are meant to keep the data safe that we upload on the Internet. An easy password can be hacked easily and all personal information can be misused. In order to prevent such things and keep the data safe, it is necessary to keep our passwords
4 min read
How to visualize selection and insertion sort using Tkinter in Python?
In this article, we are going to create a GUI application that will make us visualize and understand two of the most popular sorting algorithms better, using Tkinter module. Those two sorting algorithms are selection sort and insertion sort. Selection sort and Insertion sort are the two most popular algorithms. Selection sort is a comparison-based
6 min read
Python | Real time currency converter using Tkinter
Prerequisites : Introduction to tkinter | Get the real time currency exchange ratePython offers multiple options for developing 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 outputs the fastest and
4 min read
Python | Real time weather detection using Tkinter
Prerequisites : Introduction to tkinter | Find current weather of any cityPython offers multiple options for developing 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 outputs the fastest and easiest
5 min read
Python | Simple FLAMES game using Tkinter
Prerequisites: Introduction to TkinterProgram to implement simple FLAMES game 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 outputs the fastest and e
5 min read
Practice Tags :