Hi,
sorry to dig up this older message, but did somebody found a workaround? Executing this script works via compiling to .html with show() but not when using the bokeh server. I need this to work via bokeh server…
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource,TapTool,CustomJS
from bokeh.plotting import figure
source = ColumnDataSource(data=dict(x=[1, 2, 3],y=[2, 5, 8]))
plot=figure(tools=‘tap’,plot_width=300,plot_height=300)
plot.circle(x=‘x’,y=‘y’,source=source,size=20)
taptool = plot.select(type=TapTool)
#code=“”“window.open(‘E:\test.html’);”“”#doesn’t work via bokeh serve, otherwise it does. The http like below always works.
taptool.callback = CustomJS(args=dict(source=source), code=“”“window.open(‘http://google.com’);”“”)
doc1=curdoc()
doc1.add_root(plot)
Kind regards,
Joris
···
On Sunday, June 14, 2015 at 1:55:42 AM UTC+2, joe gi wrote:
Hi,
Ok, it does not work in the notebook but it works ok if you save the file to html
I tried something like this:
url = “file:///Users/joegi/Desktop/opt/camilo_dakota/c1/links/f1.png”
taptool = p1.select(type=TapTool)
taptool.action=OpenURL(url=url)
Joel
From: Bryan Van de Ven bry...@continuum.io
To: bo...@continuum.io
Sent: Friday, June 12, 2015 1:18 AM
Subject: Re: [bokeh] open local file using taptool
Hi Joe,
The tool just calls the JavaScript function window.open(). Presumabely if you don’t specify a protocol it defaults to “http” and whatever host the current document is on. So it might work if you give it “file” specifically:
file://Users/joegi/Desktop/inter.htm
I’ve not had a chance to test this. If it works for you, a PR that adds a note to the docstring or User’s Guide (or both) explaining this would be very appreciated.
Thanks,
Bryan
On Jun 11, 2015, at 4:29 PM, ‘joe gi’ via Bokeh Discussion - Public bo...@continuum.io wrote:
Hi,
I wonder if it is possible to open a local file using taptool
I am trying something like this:
taptool.action=OpenURL(url=“/Users/joegi/Desktop/inter.html”)
but it doesn’t work.
It seems that it is trying to open: http://localhost:8888/Users/joegi/Desktop/inter.html
joegi