Browse Source

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 năm trước cách đây
mục cha
commit
2f54e89439
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  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!