Ver código fonte

feat: alert no supporting bokeh application in non-tornado backend

wangweimin 4 anos atrás
pai
commit
90cea6f4f6
2 arquivos alterados com 6 adições e 0 exclusões
  1. 2 0
      docs/libraries_support.rst
  2. 4 0
      pywebio/platform/bokeh.py

+ 2 - 0
docs/libraries_support.rst

@@ -27,6 +27,8 @@ Bokeh
 
 在PyWebIO中,你也可以使用 ``bokeh.io.show()`` 来显示一个Bokeh App,代码示例见 `bokeh_app.py <https://github.com/wang0618/PyWebIO/blob/master/demos/bokeh_app.py>`_。
 
+.. note:: Bokeh App当前仅支持默认的Tornado后端
+
 .. image:: https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/bokeh.png
 
 pyecharts

+ 4 - 0
pywebio/platform/bokeh.py

@@ -80,6 +80,10 @@ def show_app(app, state, notebook_url, port=0, **kw):
 
     from pywebio.platform.tornado import ioloop
     loop = ioloop()
+    if loop is None:
+        toast("Currently only supports showing bokeh application in Tornado backend",
+              color='error', duration=0)
+        return
     loop.make_current()
     asyncio.set_event_loop(loop.asyncio_loop)
     # loop = IOLoop.current()