Bokeh:CustomJS错误缺少BokehJS库

2024-03-29 08:58:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用TextAreaInput在每次文本更新时自动向下滚动,当我尝试使用CustomJS时,在浏览器生成的脚本中发现以下错误:

Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing

浏览器控制台上的错误:

TypeError: Cannot read property 'connect' of undefined

以及

[bokeh] Failed to repull session TypeError: Cannot read property 'connect' of undefined

尽管我将javascript代码缩减为“nothing”,但还是出现了相同的错误。 下面是代码片段

from bokeh.models.widgets import TextAreaInput
from bokeh.models import CustomJS

class projectdata:
    def __init__(self, doc):
        self.textarea = TextAreaInput(value="XER file contents will show here!", rows = 10, name="textarea", css_classes=["mytext"])
        callback = CustomJS(args=dict(text=self.textarea),code="""""")
        self.textarea.js_on_change('scroll', callback)

Python:3.7.3, 波基:1.3.4, 浏览器:Chrome

谢谢


Tags: toselfreadconnect错误bokeh浏览器code
2条回答

经过试验,我发现错误的原因是“滚动”的行

self.textarea.js_on_change('scroll', callback)

正确的名称应该是“value”

self.textarea.js_on_change('value', callback)

在那次小小的改变之后,一切正常,但仍然在为TextArea自动滚动工作

第一个错误是告诉你没有https://pypi.org/project/bokeh/

相关问题 更多 >