win32console.GetConsoleWindow

int = GetConsoleWindow()

Returns a handle to the console's window, or 0 if none exists

Return Value

This function may raise NotImplementedError if it does not exist on the platform, or a PyHANDLE object with a value of 0. It will never raise a win32 exception.