4

The title says it all. How to move the entire window to a place on the screen using tkinter. This should be moving the root frame.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
Jan Muric
  • 59
  • 1
  • 1
  • 2

2 Answers2

10

Use the geometry method of the root (or any Toplevel) window. For example:

import tkinter as tk
root = tk.Tk()
root.geometry("+200+400") # places the window at 200,400 on the screen
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
4

use this:

from tkinter import Tk

main=Tk()
main.geometry('+100+200')
main.mainloop()

or do it with function :

def change_position(root_variable,x,y):
    root_variable.geometry('+{}+{}'.format(x,y))

and use :change_position(main,500,400)

edit: added dot for format

Community
  • 1
  • 1