def _distFrac(match, painter):
    """Convert from a fraction a/b of maxdim."""
    try:
        return painter.maxdim * float(match.group(1)) / float(match.group(4))
    except ZeroDivisionError:
        return 0.0
