positionnement fenetre

centrer une fenetre

import tkinter as tk
root = tk.Tk()
xmax = self.winfo_screenwidth()
ymax = self.winfo_screenheight()
x0 = self.x0 = xmax/2 - self.width/2
y0 = self.y0 = ymax/2 - self.height/2
root.geometry("+%d+%d" % (x0, y0))
root.update()
    root.mainloop()

centrer et modifier la taille d’une fenetre

taille de la fenetre 400x300

import tkinter as tk
root = tk.Tk()
xmax = self.winfo_screenwidth()
ymax = self.winfo_screenheight()
x0 = self.x0 = xmax/2 - self.width/2
y0 = self.y0 = ymax/2 - self.height/2
root.geometry("%dx%d+%d+%d" % (400, 300, x0, y0))
root.update()
    root.mainloop()