def toggle(self):
        """ Updates all the buffers and then toggles the buffer viewer """
        if self._visible:
            self._remove_components()
            self.hide()
        else:
            self._perform_update()
            self.show()
 Updates all the buffers and then toggles the buffer viewer 
metadrive/render_pipeline/rpcore/gui/buffer_viewer.py