本文整理汇总了Python中ipywidgets.widgets.HTML属性的典型用法代码示例。如果您正苦于以下问题:Python widgets.HTML属性的具体用法?Python widgets.HTML怎么用?Python widgets.HTML使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ipywidgets.widgets
的用法示例。
在下文中一共展示了widgets.HTML属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: config_tab
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import HTML [as 别名]
def config_tab(self):
config = get_config()
if config.ready:
config_items = list(config.as_dict().items())
config_items.sort()
config_tab = widgets.HTML(config_template.render(config=config_items))
else:
config_tab = widgets.HTML("Not loaded.")
return config_tab
示例2: render
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import HTML [as 别名]
def render(self, change=None):
header = widgets.HTML(
header_template.render(
name=self.exp.task, status=self.status, app_id=self.exp.app_id
)
)
tabs = widgets.Tab(children=[self.config_tab])
tabs.set_title(0, "Configuration")
self.children = [header, tabs]
示例3: DrawDecisionTree
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import HTML [as 别名]
def DrawDecisionTree(fac, datasetName, methodName):
m = GetMethodObject(fac, datasetName, methodName)
if m==None:
return None
tr = TreeReader(str(m.GetWeightFileName()))
variables = tr.getVariables();
def clicked(b):
if treeSelector.value>tr.getNTrees():
treeSelector.value = tr.getNTrees()
clear_output()
toJs = {
"variables": variables,
"tree": tr.getTree(treeSelector.value)
}
json_str = json.dumps(toJs)
JPyInterface.JsDraw.Draw(json_str, "drawDecisionTree", True)
mx = str(tr.getNTrees()-1)
treeSelector = widgets.IntText(value=0, font_weight="bold")
drawTree = widgets.Button(description="Draw", font_weight="bold")
label = widgets.HTML("<div style='padding: 6px;font-weight:bold;color:#333;'>Decision Tree [0-"+mx+"]:</div>")
drawTree.on_click(clicked)
container = widgets.HBox([label,treeSelector, drawTree])
display(container)
## This function puts the main thread to sleep until data points for tracking plots appear.
# @param m Method object
# @param sleep_time default sleeping time
示例4: setUp
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import HTML [as 别名]
def setUp(self):
self.children = [HTML('0'), HTML('1')]
示例5: load_json
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import HTML [as 别名]
def load_json(self, json_text):
# Allow use of widgets:
if widgets is None:
return
json = eval(json_text.strip(), {key: getattr(widgets, key) for key in dir(widgets)})
if json.get("results_filename", None):
self.results_filename = json["results_filename"]
if json.get("instructors", []):
for instructor in json["instructors"]:
self.instructors.append(instructor)
if json["activity"] == "poll":
self.index = 0
for item in json["items"]:
if item["type"] == "multiple choice":
# FIXME: allow widgets; need to rewrite create/show:
question = item["question"]
#if isinstance(question, str):
# question = widgets.HTML(question)
options = item["options"]
#for pos in range(len(options)):
# option = options[pos]
# if isinstance(option, str):
# options[pos] = widgets.HTML(option)
q = Question(item["id"], question, options)
self.questions.append(q)
else:
raise Exception("not a valid question 'type': use ['multiple choice']")
self.create_widget()
self.use_question(self.index)
else:
raise Exception("not a valid 'activity': use ['poll']")
示例6: create_widget
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import HTML [as 别名]
def create_widget(self):
self.id_widget = widgets.HTML("")
self.question_widget = widgets.HTML("")
self.choice_widgets = []
self.choice_row_list = []
for count in range(1, 5 + 1):
self.choice_widgets.append(widgets.HTML(""))
self.choice_row_list.append(widgets.HBox([widgets.HTML("<b>%s</b>) " % count),
self.choice_widgets[-1]]))
self.buttons = []
for i in range(1, 5 + 1):
button = widgets.Button(description = str(i))
button.on_click(self.handle_submit)
button.layout.margin = "20px"
self.buttons.append(button)
self.respond_row_widgets = widgets.HBox([widgets.HTML("""<br/><br clear="all"/><b>Respond</b>: """)] + self.buttons)
self.next_button = widgets.Button(description="Next")
self.next_button.on_click(self.handle_next)
self.results_button = widgets.Button(description="Results")
self.results_button.on_click(self.handle_results)
self.prev_button = widgets.Button(description="Previous")
self.prev_button.on_click(self.handle_prev)
self.results_html = widgets.HTML("")
self.top_margin = widgets.HTML("")
#self.top_margin.layout.height = "100px"
right_stack = widgets.VBox([self.top_margin, self.results_html])
self.stack = widgets.VBox([self.id_widget, self.question_widget] + self.choice_row_list +
[self.respond_row_widgets,
widgets.HBox([self.prev_button, self.results_button, self.next_button])])
self.output = widgets.Output()
self.top_level = widgets.VBox([widgets.HBox([self.stack, right_stack]),
self.output])