當前位置: 首頁>>代碼示例>>Python>>正文


Python HTML.add_element方法代碼示例

本文整理匯總了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))
開發者ID:Trey50Daniel,項目名稱:HTMLBuilder,代碼行數:9,代碼來源:HtmlElement_tests.py

示例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()
開發者ID:Trey50Daniel,項目名稱:HTMLBuilder,代碼行數:70,代碼來源:buildHTML.py

示例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))
開發者ID:Trey50Daniel,項目名稱:HTMLBuilder,代碼行數:7,代碼來源:HtmlElement_tests.py

示例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)
開發者ID:Trey50Daniel,項目名稱:HTMLBuilder,代碼行數:8,代碼來源:HtmlElement_tests.py

示例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)
開發者ID:Trey50Daniel,項目名稱:HTMLBuilder,代碼行數:8,代碼來源:HtmlElement_tests.py

示例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)
開發者ID:Trey50Daniel,項目名稱:HTMLBuilder,代碼行數:8,代碼來源:HtmlElement_tests.py

示例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())
開發者ID:Trey50Daniel,項目名稱:HTMLBuilder,代碼行數:8,代碼來源:HtmlElement_tests.py


注:本文中的HTML.HTML.add_element方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。