def pager(self, html, end="\n"): """ Construct pager using prompt_toolkit """ my_buffer = Buffer() my_window = Window( BufferControl( buffer=my_buffer, focusable=True, preview_search=True, input_processors=[FormatText()], )) my_buffer.text = html my_buffer.read_only = to_filter(True) root_container = HSplit([ my_window, ]) bindings = KeyBindings() @bindings.add("c-c") @bindings.add("q") def _(event): "Quit." event.app.exit() application = Application( layout=Layout( root_container, focused_element=my_window, ), key_bindings=bindings, enable_page_navigation_bindings=True, mouse_support=True, full_screen=True, ) application.run() super().msg(html=html, end=end)