class_docstr: Typical usage:
  
  ::
  
      output = Vt100_Output.from_pty(sys.stdout)
      r = Renderer(style, output)
      r.render(app, layout=...)
class_docstr_tok: ["Typical","usage",":",":",":","output","=","Vt100_Output.from_pty","(","sys.stdout",")","r","=","Renderer","(","style",",","output",")","r.render","(","app",",","layout=","...",")"]
docstr: Render the current interface to the output.
  
  :param is_done: When True, put the cursor at the end of the interface. We
          won't print any changes to this part.
docstr_tok: ["Render","the","current","interface","to","the","output",".",":","param","is_done",":","When","True",",","put","the","cursor","at","the","end","of","the","interface",".","We","wo","n't","print","any","changes","to","this","part","."]
code: def render(
      self, app: Application[Any], layout: Layout, is_done: bool = False
  ) -> None:
      """
      Render the current interface to the output.
  
      :param is_done: When True, put the cursor at the end of the interface. We
              won't print any changes to this part.
      """
      output = self.output
  
      # Enter alternate screen.
      if self.full_screen and not self._in_alternate_screen:
          self._in_alternate_screen = True
          output.enter_alternate_screen()
  
      # Enable bracketed paste.
      if not self._bracketed_paste_enabled:
          self.output.enable_bracketed_paste()
          self._bracketed_paste_enabled = True
  
      # Reset cursor key mode.
      if not self._cursor_key_mode_reset:
          self.output.reset_cursor_key_mode()
          self._cursor_key_mode_reset = True
  
      # Enable/disable mouse support.
      needs_mouse_support = self.mouse_support()
  
      if needs_mouse_support and not self._mouse_support_enabled:
          output.enable_mouse_support()
          self._mouse_support_enabled = True
  
      elif not needs_mouse_support and self._mouse_support_enabled:
          output.disable_mouse_support()
          self._mouse_support_enabled = False
  
      # Create screen and write layout to it.
      size = output.get_size()
      screen = Screen()
      screen.show_cursor = (
          False  # Hide cursor by default, unless one of the
      )
      # containers decides to display it.
      mouse_handlers = MouseHandlers()
  
      # Calculate height.
      if self.full_screen:
          height = size.rows
      elif is_done:
          # When we are done, we don't necessary want to fill up until the bottom.
          height = layout.container.preferred_height(
              size.columns, size.rows
          ).preferred
      else:
          last_height = (
              self._last_screen.height if self._last_screen else 0
          )
          height = max(
              self._min_available_height,
              last_height,
              layout.container.preferred_height(
                  size.columns, size.rows
              ).preferred,
          )
  
      height = min(height, size.rows)
  
      # When the size changes, don't consider the previous screen.
      if self._last_size != size:
          self._last_screen = None
  
      # When we render using another style or another color depth, do a full
      # repaint. (Forget about the previous rendered screen.)
      # (But note that we still use _last_screen to calculate the height.)
      if (
          self.style.invalidation_hash() != self._last_style_hash
          or app.style_transformation.invalidation_hash()
          != self._last_transformation_hash
          or app.color_depth != self._last_color_depth
      ):
          self._last_screen = None
          self._attrs_for_style = None
          self._style_string_has_style = None
  
      if self._attrs_for_style is None:
          self._attrs_for_style = _StyleStringToAttrsCache(
              self.style.get_attrs_for_style_str,
              app.style_transformation,
          )
      if self._style_string_has_style is None:
          self._style_string_has_style = _StyleStringHasStyleCache(
              self._attrs_for_style
          )
  
      self._last_style_hash = self.style.invalidation_hash()
      self._last_transformation_hash = (
          app.style_transformation.invalidation_hash()
      )
      self._last_color_depth = app.color_depth
  
      layout.container.write_to_screen(
          screen,
          mouse_handlers,
          WritePosition(
              xpos=0, ypos=0, width=size.columns, height=height
          ),
          parent_style="",
          erase_bg=False,
          z_index=None,
      )
      screen.draw_all_floats()
  
      # When grayed. Replace all styles in the new screen.
      if app.exit_style:
          screen.append_style_to_content(app.exit_style)
  
      # Process diff and write to output.
      self._cursor_pos, self._last_style = _output_screen_diff(
          app,
          output,
          screen,
          self._cursor_pos,
          app.color_depth,
          self._last_screen,
          self._last_style,
          is_done,
          full_screen=self.full_screen,
          attrs_for_style_string=self._attrs_for_style,
          style_string_has_style=self._style_string_has_style,
          size=size,
          previous_width=(
              self._last_size.columns if self._last_size else 0
          ),
      )
      self._last_screen = screen
      self._last_size = size
      self.mouse_handlers = mouse_handlers
  
      # Handle cursor shapes.
      new_cursor_shape = app.cursor.get_cursor_shape(app)
      if (
          self._last_cursor_shape is None
          or self._last_cursor_shape != new_cursor_shape
      ):
          output.set_cursor_shape(new_cursor_shape)
          self._last_cursor_shape = new_cursor_shape
  
      # Flush buffered output.
      output.flush()
  
      # Set visible windows in layout.
      app.layout.visible_windows = screen.visible_windows
  
      if is_done:
          self.reset()
  
imports: from __future__ import annotations
  from asyncio import FIRST_COMPLETED, Future, ensure_future, sleep, wait
  from collections import deque
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Callable, Dict, Hashable
  from prompt_toolkit.application.current import get_app
  from prompt_toolkit.cursor_shapes import CursorShape
  from prompt_toolkit.data_structures import Point, Size
  from prompt_toolkit.filters import FilterOrBool, to_filter
  from prompt_toolkit.formatted_text import AnyFormattedText, to_formatted_text
  from prompt_toolkit.layout.mouse_handlers import MouseHandlers
  from prompt_toolkit.layout.screen import Char, Screen, WritePosition
  from prompt_toolkit.output import ColorDepth, Output
  from prompt_toolkit.styles import Attrs, BaseStyle, DummyStyleTransformation, StyleTransformation
label_desc: Use image node_id 9 for calling the Renderer obj's underlying member method code with example usage: obj.render(app, layout, is_done) without return types