Update the window with the menu and the new text

def __update_window(self, width, height, message_no, page_no):
        """ Update the window with the menu and the new text """
        file_exists_label = '-F-ILE'
        if not os.path.exists(self.__create_file_name(message_no)):
            file_exists_label = '(f)ile'

        # Clear the screen
        if PLATFORM == 'win32':
            # Ugly hack until someone figures out a better way for Windows
            # probably something with a cls command, but I cannot test it
            for _ in range(50):
                print
        else:
            sys.stdout.write('\x1b[2J\x1b[H')  # Clear screen

        # Content
        content = self.messages[message_no].output.rstrip('\n')
        out = content
        if self.args.color:
            out = pygments.highlight(content, XmlLexer(), TerminalFormatter())

        # Paging functionality
        if message_no not in self.pages:
            self._form_pages(message_no, content, out, height, width)
        # Coerce in range
        page_no = max(min(len(self.pages[message_no]) - 1, page_no), 0)
        page_content = self.pages[message_no][page_no]

        # Menu
        max_message = str(len(self.messages) - 1)
        position_string = u'{{0: >{0}}}/{{1: <{0}}}'.format(len(max_message))
        position_string = position_string.format(message_no, max_message)
        # Assume less than 100 pages
        current_max_page = len(self.pages[message_no]) - 1
        pages_string = u'{0: >2}/{1: <2}'.format(page_no, current_max_page)
        menu = (u'(b)rowser | {0} | Message {1} \u2193 (s)\u2191 (w) | '
                u'Page {2} \u2190 (a)\u2192 (d) | (q)uit\n{3}').\
            format(file_exists_label, position_string, pages_string,
                   '-' * width)

        print menu
        print page_content
        return page_no