我是新来的Python3和博基。我在博基的按钮有问题。你知道吗
refresh = Button(label='refresh')
def change_click():
if refresh.label == 'refresh':
refresh.label = 'hello world'
else:
refresh.label = 'refresh'
refresh.on_click(change_click))
上面是我的代码,我正在用python和bokeh编写代码。 我想做的是,让按钮的标签改变每次我点击它,但标签只是改变为'你好世界'时,程序加载。当我点击按钮时,即使标签是“hello world”,它也不会变回刷新状态。 有人能告诉我为什么会发生这种情况,我该如何解决它。你知道吗
请记住,缩进在python中很重要。你还有一个额外的括号。这是你所期望的
用
bokeh serve show example.py
启动这个。你知道吗这也是有效的:
相关问题 更多 >
编程相关推荐