def center_on_screen(widget):
 desk = desktop()
 rect = desk.screenGeometry(QtGui.QCursor().pos())
 cy = (rect.height() // 2)
 cx = (rect.width() // 2)
 widget.move((cx - (widget.width() // 2)), (cy - (widget.height() // 2)))

def center_on_screen ( widget ) : desk = desktop ( ) rect = desk . screenGeometry ( QtGui . QCursor ( ) . pos ( ) ) cy = ( rect . height ( ) // 2 ) cx = ( rect . width ( ) // 2 ) widget . move ( ( cx - ( widget . width ( ) // 2 ) ) , ( cy - ( widget . height ( ) // 2 ) ) )
move widget to the center of the default screen .