- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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.
# 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()
Run the code to display a window that is set to its content width and height.
- Setting the position on a button in Tkinter Python?
- How do I position the buttons on a Tkinter window?
- 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 remove the title bar in a Tkinter window without using overrideredirect() method?
- How to Set a Tkinter Window with a Constant Size?
- How to copy from clipboard using tkinter without displaying a window
- Specify the dimensions of a Tkinter text box in pixels
- How to put a Toplevel window in front of the main window in Tkinter?
- How to put a Tkinter window on top of the others?
- How to take a screenshot of the window using Python?(Tkinter)
- How to make a Tkinter window jump to the front?
- How to bind the Enter key to a tkinter window?
- Tkinter-How to get the current date to display in a tkinter window?
- Setting the focus to a specific Tkinter entry widget