def auto_set_geometry(primary, secondary):
    desktop = QtGui.QApplication.desktop()

    px = primary.x()
    primary_in_left_screen = (desktop.width() / 2 - primary.width() / 2) >= px

    if primary_in_left_screen:
        secondary_x_start = px + primary.width() + (_auto_set_geometry_offset_step / 4)
    else:
        secondary_x_start = px - primary.width() - (_auto_set_geometry_offset_step / 4)

    secondary_y_start = (desktop.height() / 2) - (secondary.height() / 2) - _auto_set_geometry_offset_step

    offset_x, offset_y = _get_offset_for_auto_set_geometry()

    secondary.move(secondary_x_start + offset_x, secondary_y_start + offset_y)
auto set the geometry of secondary window base on primary window geometry
dataset/ETHPy150Open shuge/Qt-Python-Binding-Examples/qcommons/qwinutils.py/auto_set_geometry