# Bokeh web app not showing in browser

**URL:** <https://discourse.bokeh.org/t/bokeh-web-app-not-showing-in-browser/919>\
**Category:** Community Support\
**Created:** [January 11, 2016, 1:50pm UTC](https://discourse.bokeh.org/t/bokeh-web-app-not-showing-in-browser/919 "2016-01-11T13:50:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcus\_Donnelly](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/marcus_donnelly/32/1294_2.png) [@Marcus\_Donnelly](https://discourse.bokeh.org/u/Marcus_Donnelly)\
**Post date:** [January 11, 2016, 1:50pm UTC](https://discourse.bokeh.org/t/bokeh-web-app-not-showing-in-browser/919/1 "2016-01-11T13:50:28Z")

</div>

Hi,  
I’m new to Bokeh and just trying things out. I’ve tried to create a simple web app which generates a sine wave with a random frequency from a button press. I’ve created a class which inherits from VBox and stores a button and plot in the children. When I run the app with ‘bokeh serve --show MyApp.py’ at the command prompt, the server starts and I get no errors, but the browser window is empty. Don’t know what I’m doing wrong but any help gratefully received!  
Thanks,  
Marcus.  
**Code…**

import numpy

from bokeh.models import Button, Plot, ColumnDataSource  
from bokeh.plotting import Figure, curdoc  
from bokeh.models.widgets.layouts import VBox

from bokeh.core.properties import Instance,Float  
from bokeh.models.sources import DataSource

class MyApp(VBox):

```
button = Instance(Button)
plot = Instance(Plot)
ds = Instance(DataSource)
f = Float

def __init__ (self):
   
    super(MyApp,self). __init__ ()

    self.button = Button(label="Randomise Frequency")
    self.button.on_click(self.callback)
   
    self.f = 1.0

    self.plot = Figure(x_range=[0,2*numpy.pi],y_range=[-1, 1])
   
    self.ds = ColumnDataSource(data={'x':numpy.linspace(0,2*numpy.pi,100),'y':numpy.zeros(100)})
   
    self.plot.line('x','y',source=self.ds,line_width=2,line_alpha=0.5)
           
    self.children.append(self.button)
    self.children.append(self.plot)

def callback(self):
   
    self.f = numpy.random.rand()*10
    self.ds.data['y'] = 2*numpy.pi*self.f*self.ds.data['x']

```

curdoc().add\_root(MyApp())

---

<div class="post-metadata">

**Author:** ![Marcus\_Donnelly](https://discourse.bokeh.org/user_avatar/discourse.bokeh.org/marcus_donnelly/32/1294_2.png) [@Marcus\_Donnelly](https://discourse.bokeh.org/u/Marcus_Donnelly)\
**Post date:** [January 11, 2016, 2:43pm UTC](https://discourse.bokeh.org/t/bokeh-web-app-not-showing-in-browser/919/2 "2016-01-11T14:43:53Z")

</div>

Before anyone points it out I know the second last line should be:  
self.ds.data[‘y’] = numpy.sin(2_numpy.pi_self.f\*self.ds.data[‘x’])  
and the x range should be 0 to 1.  
… doh!

Obviously that hasn’t solved the problem though.

Forgot to mention, I’m using Bokeh version 0.11.0, running on Ubuntu 14.04 with Firefox as the browser.

Marcus.

> **···**
>
> On Monday, January 11, 2016 at 1:50:28 PM UTC, Marcus Donnelly wrote:
> 
> > Hi,  
> > I’m new to Bokeh and just trying things out. I’ve tried to create a simple web app which generates a sine wave with a random frequency from a button press. I’ve created a class which inherits from VBox and stores a button and plot in the children. When I run the app with ‘bokeh serve --show MyApp.py’ at the command prompt, the server starts and I get no errors, but the browser window is empty. Don’t know what I’m doing wrong but any help gratefully received!  
> > Thanks,  
> > Marcus.  
> > **Code…**
> > 
> > import numpy
> > 
> > from bokeh.models import Button, Plot, ColumnDataSource  
> > from bokeh.plotting import Figure, curdoc  
> > from bokeh.models.widgets.layouts import VBox
> > 
> > from bokeh.core.properties import Instance,Float  
> > from bokeh.models.sources import DataSource
> > 
> > class MyApp(VBox):
> > 
> > ```
> > button = Instance(Button)
> > plot = Instance(Plot)
> > ds = Instance(DataSource)
> > f = Float
> > 
> > def __init__ (self):
> >    
> > super(MyApp,self). __init__ ()
> > 
> > self.button = Button(label="Randomise Frequency")
> > self.button.on_click(self.callback)
> >    
> > self.f = 1.0
> > 
> > self.plot = Figure(x_range=[0,2*numpy.pi],y_range=[-1, 1])
> >    
> > self.ds = ColumnDataSource(data={'x':numpy.linspace(0,2*numpy.pi,100),'y':numpy.zeros(100)})
> >    
> > self.plot.line('x','y',source=self.ds,line_width=2,line_alpha=0.5)
> >            
> > self.children.append(self.button)
> > self.children.append(self.plot)
> > 
> > def callback(self):
> >    
> > self.f = numpy.random.rand()*10
> > self.ds.data['y'] = 2*numpy.pi*self.f*self.ds.data['x']
> > 
> > ```
> > 
> > curdoc().add\_root(MyApp())

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads.bokeh.org/original/2X/1/14eb24f9e10e4e9b78e3f10f66c04ffa96446e5a.svg) [@system](https://discourse.bokeh.org/u/system)\
**Post date:** [July 21, 2021, 9:07pm UTC](https://discourse.bokeh.org/t/bokeh-web-app-not-showing-in-browser/919/3 "2021-07-21T21:07:15Z")

</div>


