本文整理汇总了Python中HTML.HTML.generate_html方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.generate_html方法的具体用法?Python HTML.generate_html怎么用?Python HTML.generate_html使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML.HTML
的用法示例。
在下文中一共展示了HTML.generate_html方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Html_Builder
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import generate_html [as 别名]
#.........这里部分代码省略.........
self.C2 = Checkbutton(root, text = "Has Body", variable = self.CheckVar2, \
command = self.html_has_body, onvalue = 1, offvalue = 0, height=4, \
width = 15)
self.C1.pack()
self.C2.pack()
self.generate_button = Button(root, text='Generate HTML', command= self.make_file)
self.generate_button.place(x=30, y=115)
self.add_element_button = Button(root, text='Add Element', command = self.add_html_element)
self.add_element_button.place(x=30, y=15)
self.order_button = Button(root, text='Order Elements', command = self.order_html)
self.order_button.place(x=30, y=75)
self.delete_button = Button(root, text='Delete Element', command = self.delete_html)
self.delete_button.place(x=30, y=45)
def html_has_body(self):
if(self.CheckVar2.get() == 1):
self.html_object.has_body = True
else:
self.html_object.has_body = False
def html_full(self):
if(self.CheckVar1.get() == 1):
self.html_object.is_full_html = True
else:
self.html_object.is_full_html = False
def el_is_nested(self):
if(self.check_is_nested.get() == 1):
self.nested = True
else:
self.nested = False
def make_file(self):
self.html_object.generate_html()
self.html_object.generate_file()
def add_html_element(self):
if(self.add_item == False and self.delete_something == False):
self.option = StringVar()
self.text_element = StringVar()
self.option_list_pane = apply(OptionMenu, (root, self.option) + tuple(self.options_list))
self.option.set(self.options_list[0])
self.option_list_pane.place(x=20, y=200)
self.add_button = Button(root, text='Add', width=7, command = self.add)
self.add_button.place(x=175, y=450)
self.text_element_box = Entry(root, textvariable=self.text_element)
self.text_element_box.place(x=130, y=200)
self.check_is_nested = IntVar()
self.check_is_nested_button = Checkbutton(root, text = "Is Nested Element", variable = self.check_is_nested, \
command = self.el_is_nested, onvalue = 1, offvalue = 0, height=2, \
width = 14)
self.check_is_nested_button.place(x=260, y=200)
self.has_meta = IntVar()
self.has_meta_button = Checkbutton(root, text = "Has Attributes", variable = self.has_meta, \
command = self.el_has_meta, onvalue = 1, offvalue = 0, height=2, \
width = 14)
self.has_meta_button.place(x=260, y=275)
self.add_item = True
else:
toplevel = Toplevel()
label1 = Label(toplevel, text='Please finish your current action!', height=5, width=50)
label1.pack()
def el_has_meta(self):
if(self.has_meta.get() == 1):
self.meta = True
示例2: test_html_object_generate_not_full_html_with_elements
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import generate_html [as 别名]
def test_html_object_generate_not_full_html_with_elements(self):
html_obj = HTML(False, False, False)
test_element = html_element(False, "a", "Anchor")
html_obj.add_element(test_element)
html_obj.generate_html()
self.assertEqual("<a>Anchor</a>\n", html_obj.html_string)
示例3: test_html_object_generate_full_html_no_body_with_elements
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import generate_html [as 别名]
def test_html_object_generate_full_html_no_body_with_elements(self):
html_obj = HTML(True, False, False)
test_element = html_element(False, "a", "Anchor")
html_obj.add_element(test_element)
html_obj.generate_html()
self.assertEqual("<!DOCTYPE html>\n <html>\n<a>Anchor</a>\n</html>", html_obj.html_string)
示例4: test_html_object_generate_full_html_with_body_and_head
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import generate_html [as 别名]
def test_html_object_generate_full_html_with_body_and_head(self):
html_obj = HTML(True, True, True)
html_obj.generate_html()
self.assertEqual("<!DOCTYPE html>\n <html>\n<head>\n</head>\n<body>\n</body>\n</html>", html_obj.html_string)
示例5: test_html_object_generate_full_html_no_body
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import generate_html [as 别名]
def test_html_object_generate_full_html_no_body(self):
html_obj = HTML(True)
html_obj.generate_html()
self.assertEqual("<!DOCTYPE html>\n <html>\n</html>", html_obj.html_string)
示例6: test_html_object_generate_empty_html
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import generate_html [as 别名]
def test_html_object_generate_empty_html(self):
html_obj = HTML()
html_obj.generate_html()
self.assertEqual("", html_obj.html_string)