I am trying to add a widget dynamically to a column. I found this old post on StackOverflow but it doesn’t work.
The issue is that column(children=[…]) returns type Column and the children method in Column is of type List[UIElement] and it does not support append or insert methods like a Python list. Perhaps the Bokeh list type was introduced after the SO post.
from bokeh.io import curdoc
from bokeh.layouts import column
from bokeh.models import Button
load_data_button = Button(label="Load Data")
clear_data_button = Button(label="Clear Data")
doc_layout = column(children=[load_data_button, clear_data_button])
current_doc = curdoc().add_root(doc_layout)
new_button = Button(label="New")
doc_layout.children.append(new_button)
Am I doing something incorrectly here? Is there another/better way to do dynamic insertion of widgets? I am coming from Shiny Python and looking for the equivalent of ui_insert.


