MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / main

Function main

demos/output_usage.py:31–358  ·  view source on GitHub ↗

PyWebIO Output Usage Demonstrate various output usage supported by PyWebIO. 演示PyWebIO输出模块的使用

()

Source from the content-addressed store, hash-verified

29
30
31async def main():
32 """PyWebIO Output Usage
33
34 Demonstrate various output usage supported by PyWebIO.
35 演示PyWebIO输出模块的使用
36 """
37 put_markdown(t("""# PyWebIO Output demo
38
39 You can get the source code of this demo in [here](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)
40
41 This demo only introduces part of the functions of the PyWebIO output module. For the complete features, please refer to the [User Guide](https://pywebio.readthedocs.io/zh_CN/latest/guide.html).
42
43 The output functions are all defined in the `pywebio.output` module and can be imported using `from pywebio.output import *`.
44
45 """, """# PyWebIO 输出演示
46
47 在[这里](https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py)可以获取本Demo的源码。
48
49 本Demo仅提供了PyWebIO输出模块的部分功能的演示,完整特性请参阅[用户指南](https://pywebio.readthedocs.io/zh_CN/latest/guide.html)。
50
51 PyWebIO的输出函数都定义在 `pywebio.output` 模块中,可以使用 `from pywebio.output import *` 引入。
52
53 ### 基本输出
54 PyWebIO提供了一些便捷函数来输出表格、链接等格式:
55 """))
56
57 code_block(t(r"""
58 # Text Output
59 put_text("Hello world!")
60
61 # Table Output
62 put_table([
63 ['Commodity', 'Price'],
64 ['Apple', '5.5'],
65 ['Banana', '7'],
66 ])
67
68 # Markdown Output
69 put_markdown('~~Strikethrough~~')
70
71 # File Output
72 put_file('hello_word.txt', b'hello word!')
73 """, r"""
74 # 文本输出
75 put_text("Hello world!")
76
77 # 表格输出
78 put_table([
79 ['商品', '价格'],
80 ['苹果', '5.5'],
81 ['香蕉', '7'],
82 ])
83
84 # Markdown输出
85 put_markdown('~~删除线~~')
86
87 # 文件输出
88 put_file('hello_word.txt', b'hello word!')

Callers

nothing calls this directly

Calls 15

put_markdownFunction · 0.85
code_blockFunction · 0.85
put_tableFunction · 0.85
put_buttonsFunction · 0.85
set_scopeFunction · 0.85
put_buttonFunction · 0.85
toastFunction · 0.85
put_imageFunction · 0.85
put_textFunction · 0.85
use_scopeFunction · 0.85
put_htmlFunction · 0.85
put_gridFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…