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: Output | List[Output], css_style: str) Output | 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 ofput_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 ofput_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 thatput_xxx()
can passed in. A handler it returned byoutput()
, 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 toput_text(content)
.- Returns:
An OutputHandler instance, the methods of the instance are as follows:
reset(*contents)
: Reset original contents tocontents
append(*contents)
: Appendcontents
to original contentsinsert(idx, *contents)
: insertcontents
into original contents.when idx>=0, the output content is inserted before the element of theidx
index.when idx<0, the output content is inserted after the element of theidx
index.
Among them, the parameter
contents
is the same asoutput()
.- 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
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), ])
Added in version 1.1.
Deprecated since version 1.4: Use
pywebio.config()
instead.