- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the position of a Tkinter window without setting the dimensions?
Tkinter windows are executed after initializing the object of the Tkinter frame or window. We can define the size of the Tkinter window or frame using the Geometry manager. It defines the width and height of the initial Tkinter window where we generally place our widgets. To set the position of the Tkinter window while omitting the width and height, we can define the specification in the geometry manager.
Example
# Import the required Libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame win = Tk() # Set the geometry of tkinter frame without specifying width and height x = 500 y = 300 win.geometry("+%d+%d" %(x,y)) # Add a Label widget label = Label(win, text=" Tkinter has a variety of inbuilt functions, " "modules, and packages.", font = ('Georgia 20')) label.pack(pady=10) win.mainloop()
Output
Run the code to display a window that is set to its content width and height.
- Related Articles
- How do I position the buttons on a Tkinter window?
- Setting the position on a button in Tkinter Python?
- Python Tkinter – How to position a topLevel() widget relative to the root window?
- How to set a Tkinter window to a constant size?
- How to copy from clipboard using tkinter without displaying a window
- How to Set a Tkinter Window with a Constant Size?
- How to remove the title bar in a Tkinter window without using overrideredirect() method?
- How to put a Toplevel window in front of the main window in Tkinter?
- How do I set a minimum window size in Tkinter?
- How to set padding of all widgets inside a window or frame in Tkinter?
- How to display an image/screenshot in a Python Tkinter window without saving it?
- Tkinter-How to get the current date to display in a tkinter window?
- How to take a screenshot of the window using Python?(Tkinter)
- How to put a Tkinter window on top of the others?
- How to make a Tkinter window jump to the front?

Advertisements