可以使用小部件但不能在相同功能下绘制(散景)

可以使用小部件但不能在相同功能下绘制(散景)

问题描述:

代码分为两类 - tablerepresentation.我使用散景进行绘图。可以使用小部件但不能在相同功能下绘制(散景)

当我点击一个小部件,它会创建一个类table并带我去反对representation.get_dia(),这应该给我一个行和一个段落。从table

def update_on_button_click(): 
      print(final_data) 
      rep=representation(final_data) 
      rep.get_dia() 

get_dia()功能

代码片段 -

def get_dia(self): 
      curdoc().clear() 
      from bokeh.models import Paragraph 
      p2 = Paragraph(text='Under Construction',width=200, height=100) 
      p1=figure() 
      p1.line([1,2,3],[1,2,3]) 
      curdoc().add_root(row(p2,p1)) 

的功能显示在浏览器中的段落,但不是阴谋。

为什么会出现这种情况?

P.S如果我从table函数调用它,该图是可见的。

#from bokeh.plotting import figure --- adding this (even though I had added 
#this at the starting itself) 
def get_dia(self): 
     #curdoc().clear() --- And Removing this solves the problem 
     from bokeh.models import Paragraph 
     p2 = Paragraph(text='Under Construction',width=200, height=100) 
     p1=figure() 
     p1.line([1,2,3],[1,2,3]) 
     curdoc().add_root(row(p2,p1))