本文整理汇总了Python中HTML.HTML.add_element方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.add_element方法的具体用法?Python HTML.add_element怎么用?Python HTML.add_element使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML.HTML
的用法示例。
在下文中一共展示了HTML.add_element方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_html_object_set_element
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import add_element [as 别名]
def test_html_object_set_element(self):
html_obj = HTML()
test_element = html_element()
html_obj.add_element(test_element)
swap_element = html_element(False, "a", "Anchor")
html_obj.set_element(0, swap_element)
self.assertEqual(swap_element, html_obj.get_element(0))
示例2: Html_Builder
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import add_element [as 别名]
#.........这里部分代码省略.........
"hr",
"b",
"bdi",
"bdo",
"dfn",
"cite",
"del",
"q",
"meter",
"rp",
"rt",
"ruby"
]
self.options_list.sort()
self.add_item = False
self.nested = False
self.delete_something = False
self.meta = False
self.temp_dict = {}
self.order_number = 1
self.html_object = HTML()
self.CheckVar1 = IntVar()
self.CheckVar2 = IntVar()
self.C1 = Checkbutton(root, text = "Full HTML", variable = self.CheckVar1, \
command = self.html_full, onvalue = 1, offvalue = 0, height=4, \
width = 15)
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()
示例3: test_html_object_get_element
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import add_element [as 别名]
def test_html_object_get_element(self):
html_obj = HTML()
test_element = html_element()
html_obj.add_element(test_element)
self.assertEqual(test_element, html_obj.get_element(0))
示例4: test_html_object_generate_not_full_html_with_elements
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import add_element [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)
示例5: test_html_object_generate_full_html_no_body_with_elements
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import add_element [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)
示例6: test_html_object_set_nested_level
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import add_element [as 别名]
def test_html_object_set_nested_level(self):
html_obj = HTML()
test_element = html_element()
html_obj.add_element(test_element)
html_obj.set_element_nested_level(0, 1)
self.assertEqual(1, html_obj.get_element(0).nested_level)
示例7: test_html_object_get_nested_level_with_element_list
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import add_element [as 别名]
def test_html_object_get_nested_level_with_element_list(self):
html_obj = HTML()
test_element = html_element()
html_obj.add_element(test_element)
html_obj.set_element_nested_level(0, 1)
self.assertEqual(1, html_obj.get_top_element_nested_level())