def add_view(self, view, position=None, relative_to=None, size=(-1, -1)):
        """ Add a view. """

        try:
            self._wx_add_view(view, position, relative_to, size)
            view.visible = True

        except Exception:
            logger.exception('error creating view control <%s>', view.id)

            # Even though we caught the exception, it sometimes happens that
            # the view's control has been created as a child of the application
            # window (or maybe even the dock control).  We should destroy the
            # control to avoid bad UI effects.
            view.destroy_control()

            # Additionally, display an error message to the user.
            self.window.error('Unable to add view %s' % view.id)

        return view
dataset/ETHPy150Open enthought/pyface/pyface/ui/wx/workbench/workbench_window_layout.py/WorkbenchWindowLayout.add_view/original