def toolkit_object(name):

    mname, oname = name.split(':')
    be_mname = _toolkit_backend + mname

    class Unimplemented(object):
        """ An unimplemented toolkit object

        This is returned if an object isn't implemented by the selected
        toolkit.  It raises an exception if it is ever instantiated.
        """

        def __init__(self, *args, **kwargs):
            raise NotImplementedError("the %s pyface backend doesn't implement %s" % (ETSConfig.toolkit, oname))

    be_obj = Unimplemented

    try:
        __import__(be_mname)

        try:
            be_obj = getattr(sys.modules[be_mname], oname)
        except AttributeError:
            pass
    except ImportError as exc:
        # is the error while trying to import be_mname or not?
        if all(part not in exc.args[0] for part in mname.split('.')):
                # something else went wrong - let the exception be raised
                raise

        # Ignore *ANY* errors unless a debug ENV variable is set.
        if 'ETS_DEBUG' in os.environ:

            # Attempt to only skip errors in importing the backend modules.
            # The idea here is that this only happens when the last entry in
            # the traceback's stack frame mentions the toolkit in question.
            import traceback
            frames = traceback.extract_tb(sys.exc_traceback)
            filename, lineno, function, text = frames[-1]
            if not _toolkit_backend in filename:
                raise

    return be_obj
All associative combinations of x in n groups
dataset/ETHPy150Open enthought/pyface/pyface/toolkit.py/toolkit_object--crossover with--dataset/ETHPy150Open logpy/logpy/logpy/assoccomm.py/assocsized