def center_on_widget(self, other):
        widget = self.widget
        rect = QRect(QPoint(0, 0), widget.frameGeometry().size())
        other_widget = other.proxy.widget
        if other_widget.isWindow():
            geo = other_widget.frameGeometry()
        else:
            size = other_widget.size()
            point = other_widget.mapToGlobal(QPoint(0, 0))
            geo = QRect(point, size)
        widget.move(geo.center() - rect.center())
Center the window on another widget.
dataset/ETHPy150Open nucleic/enaml/enaml/qt/qt_window.py/QtWindow.center_on_widget