本文整理汇总了Python中zenmapGUI.higwidgets.higlabels.HIGEntryLabel.set_markup方法的典型用法代码示例。如果您正苦于以下问题:Python HIGEntryLabel.set_markup方法的具体用法?Python HIGEntryLabel.set_markup怎么用?Python HIGEntryLabel.set_markup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zenmapGUI.higwidgets.higlabels.HIGEntryLabel
的用法示例。
在下文中一共展示了HIGEntryLabel.set_markup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HighlightProperty
# 需要导入模块: from zenmapGUI.higwidgets.higlabels import HIGEntryLabel [as 别名]
# 或者: from zenmapGUI.higwidgets.higlabels.HIGEntryLabel import set_markup [as 别名]
#.........这里部分代码省略.........
"clicked", self.highlight_color_dialog_cancel,
color_dialog)
color_dialog.connect(
"delete-event", self.highlight_color_dialog_close,
color_dialog)
color_dialog.run()
def highlight_color_dialog_ok(self, widget, color_dialog):
self.highlight_color = color_dialog.colorsel.get_current_color()
color_dialog.destroy()
self.update_example()
def highlight_color_dialog_cancel(self, widget, color_dialog):
color_dialog.destroy()
def highlight_color_dialog_close(self, widget, extra, color_dialog):
color_dialog.destroy()
def update_example(self, widget=None):
start = 0
end = len(self.example)
attributes = pango.AttrList()
attributes.insert(
pango.AttrForeground(self.text_color.red,
self.text_color.green, self.text_color.blue, start, end))
attributes.insert(pango.AttrBackground(self.highlight_color.red,
self.highlight_color.green,
self.highlight_color.blue,
start, end))
# Bold verification
if self.bold_tg_button.get_active():
attributes.insert(pango.AttrWeight(pango.WEIGHT_HEAVY, start, end))
else:
attributes.insert(
pango.AttrWeight(pango.WEIGHT_NORMAL, start, end))
# Italic verification
if self.italic_tg_button.get_active():
attributes.insert(pango.AttrStyle(pango.STYLE_ITALIC, start, end))
else:
attributes.insert(pango.AttrStyle(pango.STYLE_NORMAL, start, end))
# Underline verification
if self.underline_tg_button.get_active():
attributes.insert(
pango.AttrUnderline(pango.UNDERLINE_SINGLE, start, end))
else:
attributes.insert(
pango.AttrUnderline(pango.UNDERLINE_NONE, start, end))
self.example_label.set_attributes(attributes)
def show_bold(self, widget):
self.example_label.set_markup("<>")
def get_example(self):
return self.example_label.get_text()
def set_example(self, example):
self.example_label.set_text(example)
def get_bold(self):
if self.bold_tg_button.get_active():
return 1
return 0
def set_bold(self, bold):
self.bold_tg_button.set_active(bold)
def get_italic(self):
if self.italic_tg_button.get_active():
return 1
return 0
def set_italic(self, italic):
self.italic_tg_button.set_active(italic)
def get_underline(self):
if self.underline_tg_button.get_active():
return 1
return 0
def set_underline(self, underline):
self.underline_tg_button.set_active(underline)
def get_label(self):
return self.property_name_label.get_text()
def set_label(self, label):
self.property_name_label.set_text(label)
label = property(get_label, set_label)
example = property(get_example, set_example)
bold = property(get_bold, set_bold)
italic = property(get_italic, set_italic)
underline = property(get_underline, set_underline)