I’m making an application that displays windy. However, windy updates only with f5. I would like him to update every 10 minutes.
I created the callback, and a button, and it’s working.
I want to delete the button and start the callback automatically, without the click of a button.
Follow my code.
from bokeh.driving import count from bokeh.models import ColumnDataSource, Div,TextInput, Paragraph, Button, CustomJS, ColumnDataSource from bokeh.models.widgets import Panel, Tabs from bokeh.models.tools import HoverTool from bokeh.plotting import curdoc, figure, show from bokeh.events import ButtonClick from bokeh.layouts import layout, row,column,gridplot from bokeh.server.server import Server from functools import partial windyLat="5.550" windyLong="-0.0200" coordenadas = [windyLat,windyLong] source = ColumnDataSource(data=dict(coordenadas=coordenadas)) windyMap='<iframe width="800" height="350" src="https://embed.windy.com/embed2.html?lat='+windyLat+'&lon='+windyLong+'&detailLat='+windyLat+'&detailLon='+windyLong+'&width=650&height=450&zoom=8&level=surface&overlay=wind&product=ecmwf&menu=&message=true&marker=true&calendar=now&pressure=&type=map&location=coordinates&detail=&metricWind=default&metricTemp=default&radarRange=-1" frameborder="0"></iframe>' twindy= Div(text=windyMap,width=300, height=300,name="twindy",sizing_mode='stretch_both') callback = CustomJS(args=dict(source=source),code=""" var data= source.data.coordenadas; var windyLat=data[0]; var windyLong=data[1]; setInterval(function(){ document.getElementsByTagName('iframe')[0].src='https://embed.windy.com/embed2.html?lat='+windyLat+'&lon='+windyLong+'&detailLat='+windyLat+'&detailLon='+windyLong+'&width=650&height=450&zoom=8&level=surface&overlay=wind&product=ecmwf&menu=&message=true&marker=true&calendar=now&pressure=&type=map&location=coordinates&detail=&metricWind=default&metricTemp=default&radarRange=-1'+'&no-cache='+Math.random() }, 1000) """) callback btn=Button(label="No Alerts",button_type="success",width=80) btn.js_on_click(callback) r=row(twindy,btn) show(r)