Skip to content

Instantly share code, notes, and snippets.

@vigilantPotato
Last active June 12, 2024 21:38
Show Gist options
  • Save vigilantPotato/cc289f9833a9071068319b2102ca2513 to your computer and use it in GitHub Desktop.
Save vigilantPotato/cc289f9833a9071068319b2102ca2513 to your computer and use it in GitHub Desktop.
How to show main window's size and location
import ctypes
import tkinter
def show_geometry_info(event):
geo_label["text"] = root.geometry()
if __name__ == "__main__":
ctypes.windll.shcore.SetProcessDpiAwareness(1)
root = tkinter.Tk()
geo_label = tkinter.Label(root, bg="lightblue", font=("Helvetica", "17"))
geo_label.pack(anchor="center", expand=1)
root.bind("<Configure>", show_geometry_info)
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment