def MoveToCenter(self) -> bool:
if self.IsTopLevel():<EOL><INDENT>rect = self.BoundingRectangle<EOL>screenWidth, screenHeight = GetScreenSize()<EOL>x, y = (screenWidth - rect.width()) // <NUM_LIT:2>, (screenHeight - rect.height()) // <NUM_LIT:2><EOL>if x < <NUM_LIT:0>: x = <NUM_LIT:0><EOL>if y < <NUM_LIT:0>: y = <NUM_LIT:0><EOL>return SetWindowPos(self.NativeWindowHandle, SWP.HWND_Top, x, y, <NUM_LIT:0>, <NUM_LIT:0>, SWP.SWP_NoSize)<EOL><DEDENT>return False<EOL>
Move window to screen center.