2016-06-07 4 views
1
내가 Jupyter 노트북과 함께 일하고 당신이 문자를 입력 제안 텍스트 상자와 함께 작동하도록 얻을. 내가 찾은 좋은 예 내가 사용자로 제안을 할 here.

Jupyter 자동 완성 제안 텍스트 상자

입니다 노력하고

문자를 입력하므로 입력 된 모든 문자에 대한 제안 목록이 변경됩니다.

전 Jupyter를 처음 사용하며 아직 모든 기능을 배우려고합니다. ipython 위젯 (다른 패키지를 설치할 수 없음)과 같은 기본 Jupyter 도구에 의존해야합니다. 어떤 도움이라도 대단히 감사 할 것입니다.

답변

1

보케의 AutocompleteInput을 사용해 보셨습니까?

Access data from bokeh widgets in a jupyter notebook

from bokeh.models.widgets.inputs import AutocompleteInput 
from bokeh.io import output_notebook 
from bokeh.plotting import show 
from bokeh.models import CustomJS 

output_notebook() 

callback = CustomJS(code=""" 
if (IPython.notebook.kernel !== undefined) { 
    var kernel = IPython.notebook.kernel; 
    cmd = "widget_value = '" + cb_obj.value + "'"; 
    kernel.execute(cmd, {}, {}); 
} 
""") 

txt_input = AutocompleteInput(completions=['val1', 'val2'], callback=callback) 

show(txt_input) 

print(widget_value) 

편집 :에서 다음 예제를 확인 난 그냥 당신이 패키지를 설치할 수 없습니다 보았다. 그러나 위의 대답을 설치하려면 bokeh이 필요합니다.