소스 검색

put_image example using bytes-like object (#172)

* put_image example using bytes-like object

* Update docs/guide.rst

Co-authored-by: WangWeimin <wang0.618@qq.com>

Co-authored-by: WangWeimin <wang0.618@qq.com>
Déborah Mesquita 3 년 전
부모
커밋
2f54e89439
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      docs/guide.rst

+ 3 - 2
docs/guide.rst

@@ -215,7 +215,8 @@ Using output functions, you can output a variety of content, such as text, table
     ## ----
 
     # Image Output
-    put_image('some-image.png')  # ..doc-only
+    put_image(open('/path/to/some/image.png', 'rb').read())  # local image # ..doc-only
+    put_image('http://example.com/some-image.png')  # internet image # ..doc-only
     put_image('https://www.python.org/static/img/python-logo.png')  # ..demo-only
     ## ----
 
@@ -796,4 +797,4 @@ ask yourself a question: What would I do if it is in a terminal program?
 If you already have the answer, it can be done in the same way with PyWebIO. If the problem persists or the solution is
 not good enough, you can consider the :ref:`callback mechanism <callback>` or  :doc:`pin <./pin>` module.
 
-OK, Have fun with PyWebIO!
+OK, Have fun with PyWebIO!