
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How can I resize the root window in Tkinter?
In this example, we will see how to resize a tkinter window using the geometry manager. Tkinter geometry manager is generally used to configure the width and height of a tkinter window.
The geometry(width, height)method takes width and height as instances and resizes the window accordingly. We can also define the position of the tkinter window by adding geometry(width x height, X, Y) where x and y are horizontal and vertical positions of the window.
Example
#Import tkinter library from tkinter import * from tkinter import ttk #Create an instance of tkinter frame or window win= Tk() #Set the geometry of tkinter frame win.geometry("750x250+400+300") #Create a Label widget label1= Label(win, text="Hello There!", font= ('Courier 20 underline')) label1.pack() win.mainloop()
Output
Now, run the above code to display the dynamically resized tkinter window.
- Related Articles
- How do I get rid of the Python Tkinter root window?
- How to resize the background image to window size in Tkinter?
- Resize the Tkinter Listbox widget when the window resizes
- Dynamically Resize Buttons When Resizing a Window using Tkinter
- How can I prevent a window from being resized with Tkinter?
- How do I close a tkinter window?
- How do I handle the window close event in Tkinter?
- How to Resize Browser Window in WebDriver?
- How do I create a popup window in Tkinter?
- Python Tkinter – How to position a topLevel() widget relative to the root window?
- How do I position the buttons on a Tkinter window?
- How do I set a minimum window size in Tkinter?
- How do I use Window Manager (wm) attributes in Tkinter?
- How do I open a website in a Tkinter window?
- How to explicitly resize frames in tkinter?

Advertisements