コード例 #1
0
def show_file(file_name=None, title="Title", file_type="text"):
    '''Displays a file in a window.  While it looks as though the file
       can be edited, the only changes that happened are in the window
       and nothing can be saved.

       :param title: the window title
       :param file_name: the file name, (path) relative to the calling program
       :param file_type: possible values: ``text``, ``code``, ``html``, ``python``.

       By default, file_type is assumed to be ``text``; if set to ``code``,
       the content is displayed with a monospace font and, if
       set to ``python``, some code highlighting is done.
       If the file_type is ``html``, it is processed assuming it follows
       html syntax.

       **Note**: a better Python code hightlighter would be most welcome!

       >>> import easygui_qt as easy
       >>> easy.show_file()

       .. image:: ../docs/images/show_file.png
    '''
    app = SimpleApp()
    editor = show_text_window.TextWindow(file_name=file_name,
                                         title=title,
                                         text_type=file_type)
    editor.show()
    app.exec_()
コード例 #2
0
def show_code(title="Title", code=None):
    '''Displays some text in a window, in a monospace file.

       :param title: the window title
       :param code: a string to display in the window.

       >>> import easygui_qt as easy
       >>> easy.show_code()

       .. image:: ../docs/images/show_code.png
    '''
    app = SimpleApp()
    editor = show_text_window.TextWindow(title=title, code=code)
    editor.resize(720, 450)
    editor.show()
    app.exec_()
コード例 #3
0
def show_html(title="Title", text=""):
    '''Displays some html text in a window.

       :param title: the window title
       :param code: a string to display in the window.

       >>> import easygui_qt as easy
       >>> easy.show_html()

       .. image:: ../docs/images/show_html.png
    '''
    app = SimpleApp()
    editor = show_text_window.TextWindow(title=title,
                                         text_type='html',
                                         text=text)
    editor.resize(720, 450)
    editor.show()
    app.exec_()