2016-04-14 18 views

回答

2

巴拿巴,如果你沒有提供實際的代碼,並且極其詳細地描述你已經嘗試過,那麼診斷問題基本上是不可能的。 FWIW這裏是一個很小的腳本,渲染背景虛化Button在燒瓶中的應用:

進口燒瓶

from bokeh.embed import components 
from bokeh.core.templates import FILE 
from bokeh.models.widgets import Button 
from bokeh.resources import INLINE 
from bokeh.util.string import encode_utf8 

app = flask.Flask(__name__) 

@app.route("/") 
def foo(): 
    button = Button(label="test") 

    script, div = components(button, INLINE) 
    html = FILE.render(
     plot_script=script, 
     plot_div=div, 
     bokeh_js=INLINE.render_js(), 
     bokeh_css=INLINE.render_css(), 
    ) 
    return encode_utf8(html) 

app.run(debug=True) 

有件事情我肯定會做在實際部署不同的(無INLINE資源,例如),但沒有關於您的實際使用案例或您真正想要做的事情的額外信息,則無法提供其他指導。

0

事實證明,要使用小部件,需要在HTML頁面中包含額外的js和css。
在我而言那些都是

  • 背景虛化,0.11.1.min.js,
  • 背景虛化的小部件,0.11.1.min.js
  • 背景虛化編譯器,0.11.1.min。 js和
  • bokeh-widgets-0.11.1.min.css。
相關問題