pymhf.core.utils module#

pymhf.core.utils.does_pid_have_focus(pid: int) bool#
pymhf.core.utils.get_foreground_pid()#
pymhf.core.utils.get_foreground_window_title() str | None#
pymhf.core.utils.get_hwnds_for_pid(pid: int) list[int]#

Return all HWND’s for the provided PID.

pymhf.core.utils.get_main_window()#
pymhf.core.utils.get_main_window_handle() int | None#

Return the handle of the main running application window if possible. This will correspond to the HWND for the window belonging to the PID of the main running process.

pymhf.core.utils.get_window_by_handle(handle: int) Win32Window | None#
pymhf.core.utils.is_main_window_foreground() bool#
pymhf.core.utils.safe_assign_enum(enum, index: int)#

Safely try and get the enum with the associated integer value. If the index isn’t one in the enum return the original index.

pymhf.core.utils.saferun(func, *args, **kwargs)#

Safely run the specified function with args and kwargs.

Any exception raised will be shown and ignored

pymhf.core.utils.saferun_decorator(func: Callable)#

Safely run the decorated function so that any errors are caught and logged.

pymhf.core.utils.set_main_window_active(callback: Callable[[], None] | None = None)#

Set the main window as active. If a callback is provided, it will be called after activating the window. This callback must not take any arguments and any return value will be ignored.