Skip to content

Instantly share code, notes, and snippets.

@FyeCobain
Last active June 3, 2024 00:01
Show Gist options
  • Save FyeCobain/a21564aad4b3d4fe458f8e249dbcc43b to your computer and use it in GitHub Desktop.
Save FyeCobain/a21564aad4b3d4fe458f8e249dbcc43b to your computer and use it in GitHub Desktop.
Python: Center Tkinter root
width, height, rise = 300, 250, 70
x, y = root.winfo_screenwidth()/2-width/2, root.winfo_screenheight()/2-height/2-rise
root.geometry('%dx%d+%d+%d' % (width, height, x, y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment