Я нашел ответ!
Очевидно, вы можете использовать методы и свойства tkinter непосредственно для объектов guizero.
Как это происходит, свойство geometry возвращает строку, содержащую координаты окна.
так что это пример:
from guizero import App, PushButton
#___________________________________
def appos(event_data):
""" Print the coordinates of the Window position,
of the mouse position on the screen
and of the mouse position within the window"""
# Absolute mouse position on display
mouse_x, mouse_y = (event_data.display_x), (event_data.display_y)
# tk.geometry() returns the size and coordinates of a window in a string
wincord = (app.tk.geometry()).split("+")[1:] # Discards size
# Coordinates of (top left corner) of window
wincord_x, wincord_y = int(wincord[0]), int (wincord[1])
# Relative mouse position within the window
mouse_rel_x = mouse_x - wincord_x
mouse_rel_y = mouse_y - wincord_y
print ("Window position on display: ", wincord_x, wincord_y)
print ("Mouse position on entire display: ", mouse_x, mouse_y)
print ("Mouse position in window: ", mouse_rel_x, mouse_rel_y)
print()
#_________________________________
app = App(layout="grid")
app.when_clicked = appos # Call the function that prints the positions
# Creates a list of lists (kinda a 2-dimension array) with
# placeholders to be filled with buttons
bt = [[0,1,2,3,4,5,6,7],
[0,1,2,3,4,5,6,7],
[0,1,2,3,4,5,6,7],
[0,1,2,3,4,5,6,7],
[0,1,2,3,4,5,6,7],
[0,1,2,3,4,5,6,7],
[0,1,2,3,4,5,6,7],
[0,1,2,3,4,5,6,7]]
# creates an array of 8x8 buttons and arrange them on the window
for x in range (8):
for y in range (8):
bt[x][y] = PushButton(app, text= str(x)+str(y), grid= [x, y])
# bt[x][y].when_clicked = clicked # For future use
app.display()
Как видите, щелкнув в любом месте окна, вы получите правильное положение мыши в окне, даже если оно закрыто кнопками!