
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set Tkinter Window Position Without Setting 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.
Advertisements