【发布时间】:2020-02-10 08:00:57
【问题描述】:
我在 jupyter 笔记本中有以下代码,ipywidgets 7.5.1 是登录掩码
from ipywidgets import widgets
class Login:
def __init__(self):
text21 = widgets.Text(description="username")
text22 = widgets.Text(description = "password")
self.button = widgets.Button(
description='Login NSG',
disabled=False,
button_style='info',
tooltip='Login with username and password',
)
self.vbox_conf = widgets.VBox(children=[text21, text22, self.button])
self.button.observe(self.login)
# alternative: self.button.observe(self.login, names='value')
display(self.vbox_conf)
def login(self, args):
print("test")
print(args)
login = Login()
它呈现了一个登录掩码,但是当我按下按钮时没有任何反应!什么都没有打印出来,也没有打印在笔记本上,也没有在日志窗口中!
发生了什么以及如何解决这个问题?
【问题讨论】:
标签: python jupyter ipywidgets