On windows, it is possible to change the position of an initialized window using its handle (hwnd). In User32.dll
there is a function called MoveWindow, that recieves a window's handle and changes its position. You can call it using python's standard ctypes
module.
from ctypes import windll
def moveWin(x, y):
# the handle to the window
hwnd = pygame.display.get_wm_info()['window']
# user32.MoveWindow also recieves a new size for the window
w, h = pygame.display.get_surface().get_size()
windll.user32.MoveWindow(hwnd, x, y, w, h, False)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…