The outdated functions

This section shows document of the deprecated functions in case you use the previous version of PyWebIO.

Those functions still work in latest PyWebIO, however they may be removed in future version.

output module

pywebio.output.style(outputs: Union[pywebio.io_ctrl.Output, List[pywebio.io_ctrl.Output]], css_style: str)Union[pywebio.io_ctrl.Output, pywebio.io_ctrl.OutputList][source]

Customize the css style of output content

Deprecated since version 1.3: See User Guide for new way to set css style for output.

Parameters
  • outputs (list/put_xxx()) – The output content can be a put_xxx() call or a list of it.

  • css_style (str) – css style string

Returns

The output contents with css style added:

Note: If outputs is a list of put_xxx() calls, the style will be set for each item of the list. And the return value can be used in anywhere accept a list of put_xxx() calls.

Example

style(put_text('Red'), 'color:red')

style([
    put_text('Red'),
    put_markdown('~~del~~')
], 'color:red')

put_table([
    ['A', 'B'],
    ['C', style(put_text('Red'), 'color:red')],
])

put_collapse('title', style([
    put_text('text'),
    put_markdown('~~del~~'),
], 'margin-left:20px'))
pywebio.output.output(*contents)[source]

Placeholder of output

Deprecated since version 1.5: See User Guide for new way to set css style for output.

output() can be passed in anywhere that put_xxx() can passed in. A handler it returned by output(), and after being output, the content can also be modified by the handler (See code example below).

Parameters

contents – The initial contents to be output. The item is put_xxx() call, and any other type will be converted to put_text(content).

Returns

An OutputHandler instance, the methods of the instance are as follows:

  • reset(*contents) : Reset original contents to contents

  • append(*contents) : Append contents to original contents

  • insert(idx, *contents) : insert contents into original contents.

    when idx>=0, the output content is inserted before the element of the idx index.
    when idx<0, the output content is inserted after the element of the idx index.

Among them, the parameter contents is the same as output().

Example

hobby = output(put_text('Coding'))  # equal to output('Coding')
put_table([
   ['Name', 'Hobbies'],
   ['Wang', hobby]      # hobby is initialized to Coding
])

hobby.reset('Movie')  # hobby is reset to Movie
hobby.append('Music', put_text('Drama'))  # append Music, Drama to hobby
hobby.insert(0, put_markdown('**Coding**'))  # insert the Coding into the top of the hobby

session module

pywebio.session.get_info()[source]

Get information about the current session

Deprecated since version 1.2: Use info instead.

pywebio.session.data()[source]

Get the session-local object of current session.

Deprecated since version 1.1: Use local instead.

platform module

pywebio.platform.seo(title, description=None, app=None)[source]

Set the SEO information of the PyWebIO application (web page information provided when indexed by search engines)

Parameters
  • title (str) – Application title

  • description (str) – Application description

  • app (callable) – PyWebIO task function

If seo() is not used, the docstring of the task function will be regarded as SEO information by default.

seo() can be used in 2 ways: direct call and decorator:

@seo("title", "description")
def foo():
    pass

def bar():
    pass

def hello():
    """Application title

    Application description...
    (A empty line is used to separate the description and title)
    """

start_server([
    foo,
    hello,
    seo("title", "description", bar),
])

New in version 1.1.

Deprecated since version 1.4: Use pywebio.config() instead.