I use tk in python (3), although I would suggest that this applies to any language. I want to get the current x, y coordinates of the tk window outside the title bar:
import tkinter root = tkinter.Tk()
however using root.winfo_y() gives me the coordinates, including the depth of the header. For the window located in the upper left corner of the screen:
root.winfo_x(), root.winfo_y() # returns (0, 22)
In other words, launch:
root.geometry('+{}+{}'.format(root.winfo_x(), root.winfo_y()))
will move the window 22 pixels (the height of the title bar) every time I call it. How to get the actual coordinates of the whole window?
source share