如何使用切换按钮禁用Jupyter小部件按钮?

时间:2020-03-19 06:14:38

标签: python jupyter-notebook widget

我在按下切换按钮时禁用某个按钮时遇到问题。我知道大多数人会建议使用链接,但就我而言,由于切换按钮也与另一个文本区域链接,因此我无法使用它。这是我的代码,以使其更加清晰

degree_text=widgets.BoundedIntText(
    min=0,
    max=360,
    step=1,
    description='Color Degree',
    disabled=False
)

lock = widgets.ToggleButton(description = "Lock",layout=space_between)

start_button = widgets.Button(
    description='Start',
    button_style='success',
    tooltip='Click to start reconstruction',
    icon='check', # (FontAwesome names without the `fa-` prefix)
    layout = space_between,
    disabled=True
)

link((lock,'value'),(degree_text,'disabled'))
#cant use link because I need the degree text and start button to have opposite disabled status
#link((lock,'value'),(start_button,'disabled'))

我希望有人可以帮助我。谢谢

0 个答案:

没有答案