wangweimin hace 4 años
padre
commit
6af4d280c8
Se han modificado 2 ficheros con 18 adiciones y 3 borrados
  1. 1 1
      README.md
  2. 17 2
      pywebio/output.py

+ 1 - 1
README.md

@@ -29,7 +29,7 @@
         <img src="https://img.shields.io/github/license/wang0618/PyWebIO.svg" alt="License">
         <img src="https://img.shields.io/github/license/wang0618/PyWebIO.svg" alt="License">
     </a>
     </a>
     <br/>
     <br/>
-    <a href="https://pywebio.readthedocs.io">[Document]</a> | <a href="http://pywebio-demos.demo.wangweimin.site/">[Demos]</a>
+    <a href="https://pywebio.readthedocs.io">[Document]</a> | <a href="http://pywebio-demos.demo.wangweimin.site/">[Demos]</a> | <a href="https://github.com/wang0618/PyWebIO/wiki/Why-PyWebIO%3F">[Why PyWebIO?]</a>
 </p>
 </p>
 
 
 PyWebIO提供了一系列命令式的交互函数来在浏览器上获取用户输入和进行输出,将浏览器变成了一个“富文本终端”,可以用于构建简单的Web应用或基于浏览器的GUI应用。
 PyWebIO提供了一系列命令式的交互函数来在浏览器上获取用户输入和进行输出,将浏览器变成了一个“富文本终端”,可以用于构建简单的Web应用或基于浏览器的GUI应用。

+ 17 - 2
pywebio/output.py

@@ -903,9 +903,24 @@ def put_scrollable(content, height=400, keep_bottom=False, horizon_scroll=False,
     :param bool border: 是否显示边框
     :param bool border: 是否显示边框
     :param int scope, position: 与 `put_text` 函数的同名参数含义一致
     :param int scope, position: 与 `put_text` 函数的同名参数含义一致
 
 
+    使用示例:
+
+    .. exportable-codeblock::
+        :name: put_scrollable
+        :summary: `put_scrollable()` 使用示例
+
+        import time
+
+        o = output("You can click the area to prevent auto scroll.")
+        put_scrollable(o, height=200, keep_bottom=True)
+
+        while 1:
+            o.append(str(time.time()))
+            time.sleep(0.5)
+
     .. versionchanged:: 1.1
     .. versionchanged:: 1.1
        添加 ``height`` 参数,移除 ``max_height`` 参数;
        添加 ``height`` 参数,移除 ``max_height`` 参数;
-       添加 ``auto_scroll_bottom`` 参数
+       添加 ``keep_bottom`` 参数
     """
     """
     if not isinstance(content, (list, tuple, OutputList)):
     if not isinstance(content, (list, tuple, OutputList)):
         content = [content]
         content = [content]
@@ -1062,7 +1077,7 @@ def _row_column_layout(content, flow, size, scope=Scope.Current, position=Output
 
 
     content = [c if c is not None else put_html('<div></div>') for c in content]
     content = [c if c is not None else put_html('<div></div>') for c in content]
     for item in content:
     for item in content:
-        assert isinstance(item, Output), "put_row() content must be list of put_xxx()"
+        assert isinstance(item, Output), "put_row()/put_column()'s content must be list of put_xxx()"
 
 
     style = 'grid-auto-flow: {flow}; grid-template-{flow}s: {size};'.format(flow=flow, size=size)
     style = 'grid-auto-flow: {flow}; grid-template-{flow}s: {size};'.format(flow=flow, size=size)
     tpl = """
     tpl = """