Tkinter is a Python module which is used to develop GUI (Graphical User Interface) applications. It comes along with the 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 the main window on the user’s desktop.
Code #1: Tkinter window without using geometry method.
As soon as you run the application, you’ll see the position of the Tkinter window is at the north-west position of the screen and the size of the window is also small as shown in the output.
When you run the application, you’ll observe that the position and size both are changed. Now the Tkinter window is appearing at a different position (300 shifted on Y-axis and 400 shifted on X-axis).
Note: We can also pass a variable argument in the geometry method, but it should be in the form (variable1) x (variable2); otherwise, it will raise an error.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | after method in Tkinter
- resizable() method in Tkinter | Python
- minsize() method in Tkinter | Python
- maxsize() method in Tkinter | Python
- destroy() method in Tkinter | Python
- iconphoto() method in Tkinter | Python
- Python | forget_pack() and forget_grid() method in Tkinter
- Python Tkinter | Moving objects using Canvas.move() method
- Python | place() method in Tkinter
- Python | pack() method in Tkinter
- Python | grid() method in Tkinter
- Python Tkinter | grid_location() and grid_size() method
- Place_forget() method using Tkinter in Python
- Python GUI - tkinter
- Python | askopenfile() function in Tkinter
- Python | Binding function in Tkinter
- Color game using Tkinter in Python
- Python | Message Encode-Decode using Tkinter
- Python - Tkinter askquestion Dialog
- Python | Simple registration form using Tkinter
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : abergquist