class_docstr: Margin displaying a scrollbar.
  
  :param display_arrows: Display scroll up/down arrows.
class_docstr_tok: ["Margin","displaying","a","scrollbar",".",":","param","display_arrows",":","Display","scroll","up\/down","arrows","."]
code: def create_margin(
      self,
      window_render_info: WindowRenderInfo,
      width: int,
      height: int,
  ) -> StyleAndTextTuples:
      content_height = window_render_info.content_height
      window_height = window_render_info.window_height
      display_arrows = self.display_arrows()
  
      if display_arrows:
          window_height -= 2
  
      try:
          fraction_visible = len(
              window_render_info.displayed_lines
          ) / float(content_height)
          fraction_above = window_render_info.vertical_scroll / float(
              content_height
          )
  
          scrollbar_height = int(
              min(
                  window_height,
                  max(1, window_height * fraction_visible),
              )
          )
          scrollbar_top = int(window_height * fraction_above)
      except ZeroDivisionError:
          return []
      else:
  
          def is_scroll_button(row: int) -> bool:
              "True if we should display a button on this row."
              return (
                  scrollbar_top
                  <= row
                  <= scrollbar_top + scrollbar_height
              )
  
          # Up arrow.
          result: StyleAndTextTuples = []
          if display_arrows:
              result.extend(
                  [
                      ("class:scrollbar.arrow", self.up_arrow_symbol),
                      ("class:scrollbar", "\n"),
                  ]
              )
  
          # Scrollbar body.
          scrollbar_background = "class:scrollbar.background"
          scrollbar_background_start = (
              "class:scrollbar.background,scrollbar.start"
          )
          scrollbar_button = "class:scrollbar.button"
          scrollbar_button_end = "class:scrollbar.button,scrollbar.end"
  
          for i in range(window_height):
              if is_scroll_button(i):
                  if not is_scroll_button(i + 1):
                      # Give the last cell a different style, because we
                      # want to underline this.
                      result.append((scrollbar_button_end, " "))
                  else:
                      result.append((scrollbar_button, " "))
              else:
                  if is_scroll_button(i + 1):
                      result.append((scrollbar_background_start, " "))
                  else:
                      result.append((scrollbar_background, " "))
              result.append(("", "\n"))
  
          # Down arrow
          if display_arrows:
              result.append(
                  ("class:scrollbar.arrow", self.down_arrow_symbol)
              )
  
          return result
  
imports: from __future__ import annotations
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING, Callable
  from prompt_toolkit.filters import FilterOrBool, to_filter
  from prompt_toolkit.formatted_text import StyleAndTextTuples, fragment_list_to_text, to_formatted_text
  from prompt_toolkit.utils import get_cwidth
  from .controls import UIContent
label_desc: Use image node_id 3 for calling the ScrollbarMargin obj's underlying member method code with example usage: obj.create_margin(window_render_info, width, height) and returns: result, list, unknown