def init_window(self, hwnd=None, pos=None, borderless=False, config = None):
"""
At the moment only sets the window in the foreground and moves it to a posistion set in the config.
Args:
hwnd (int): the window handle to "initialize". If not supplied
the hwnd from the last get_hwnd_by_title will be used
pos (tuple): a tuple describing the X,Y,Height and Width of the window
borderless (Bool): Removes extra styling like borders if true. Can be reapplied with:
hide_extra_ui(hwnd,remove=False)
Returns:
If the window was brought to the foreground, the return value is
nonzero. If the window was not brought to the foreground, the
return value is zero.
"""
if hwnd is None:
hwnd = self.get_hwnd()
logging.debug("Init window 0x{:2x}".format(hwnd))
if borderless:
self.hide_extra_ui()
if pos is not None:
self.move(pos, hwnd)
return win32gui.SetForegroundWindow(hwnd)
评论列表
文章目录