本文整理汇总了Python中HTML.HTML.del_element方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.del_element方法的具体用法?Python HTML.del_element怎么用?Python HTML.del_element使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML.HTML
的用法示例。
在下文中一共展示了HTML.del_element方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Html_Builder
# 需要导入模块: from HTML import HTML [as 别名]
# 或者: from HTML.HTML import del_element [as 别名]
#.........这里部分代码省略.........
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
self.meta_label = Label(root, text='Attribute Text:')
self.meta_label.place(x=20, y=275)
self.add_meta_button = Button(root, text='Add Attribute', width=11, command = self.add_meta)
self.add_meta_button.place(x=115, y=330)
self.value_label = Label(root, text='Attribute Value:')
self.value_label.place(x=20, y=300)
self.meta_text = StringVar()
self.meta_element_box = Entry(root, textvariable=self.meta_text)
self.meta_element_box.place(x=115, y=275)
self.value_text = StringVar()
self.value_box = Entry(root, textvariable=self.value_text)
self.value_box.place(x=115, y=300)
else:
self.meta = False
def add_meta(self):
self.temp_dict[self.meta_text.get()] = self.value_text.get()
print self.temp_dict[self.meta_text.get()]
#self.html_object.meta_dict = self.temp_dict
def order_html(self):
square = self.html_object.is_full_html
def delete_html(self):
if not self.html_object.element_list:
toplevel2 = Toplevel()
label1 = Label(toplevel2, text='There are no items to delete', height=5, width=50)
label1.pack()
elif(self.add_item):
toplevel3 = Toplevel()
label1 = Label(toplevel3, text='Please finish your current action!', height=5, width=50)
label1.pack()
else:
self.delete_something = True
self.w = Spinbox(root, values=tuple(self.html_object.get_element_list()), width=30)
self.w.place(x=175, y=225)
self.delete_button = Button(root, text='Delete', width=7, command = self.delete)
self.delete_button.place(x=175, y = 275)
def delete(self):
self.deleted_object = self.w.get()
self.html_object.del_element(self.deleted_object)
self.delete_something = False
self.w.destroy()
self.delete_button.destroy()
def add(self):
element_object = html_element(self.nested, self.option.get(), self.text_element.get(), self.order_number, self.temp_dict)
temp = self.html_object.get_top_element_nested_level()
if (element_object.is_nested):
element_object.nested_level = temp + 1
print element_object.nested_level
else:
temp = 0
element_object.nested_level = 0
self.html_object.add_element(element_object)
self.order_number += 1
#destroy all of the add options once the object has been added
self.add_item = False
self.nested = False
self.option_list_pane.destroy()
self.add_button.destroy()
self.text_element_box.destroy()
self.check_is_nested_button.destroy()
self.has_meta_button.destroy()
self.value_box.destroy()
self.value_label.destroy()
if (self.meta):
self.meta = False
self.meta_label.destroy()
self.meta_element_box.destroy()
self.add_meta_button.destroy()