code: def enable_messaging(message_viewer, sender=dispatcher.Any):
      
      # Set up dispatcher for dynamic messages
      # Dynamic messages will not clear the message queue so will be appended
      # to existing user messages
      LOGGER.debug('enable_messaging %s %s' % (message_viewer, sender))
      # noinspection PyArgumentEqualDefault
      dispatcher.connect(
          message_viewer.dynamic_message_event,
          signal=DYNAMIC_MESSAGE_SIGNAL,
          sender=sender)
      # Set up dispatcher for static messages
      # Static messages clear the message queue and so the display is 'reset'
      # noinspection PyArgumentEqualDefault
      dispatcher.connect(
          message_viewer.static_message_event,
          signal=STATIC_MESSAGE_SIGNAL,
          sender=sender)
      # Set up dispatcher for error messages
      # Error messages clear the message queue and so the display is 'reset'
      # noinspection PyArgumentEqualDefault
      dispatcher.connect(
          message_viewer.static_message_event,
          signal=ERROR_MESSAGE_SIGNAL,
          sender=sender)
docs: Set up the dispatcher for messaging.
  
      :param message_viewer: A message viewer to show the message.
      :type message_viewer: MessageViewer
  
      :param sender: Sender of the message signal. Default to Any object.
      :type sender: object