本文整理汇总了Python中gtk.TextBuffer方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.TextBuffer方法的具体用法?Python gtk.TextBuffer怎么用?Python gtk.TextBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.TextBuffer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: vwSetTagTable
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TextBuffer [as 别名]
def vwSetTagTable(self, tagtable):
self.tagtable = tagtable
self.textbuf = gtk.TextBuffer(self.tagtable)
self.textview.set_buffer(self.textbuf)
示例2: createClockDisplayWidgets
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TextBuffer [as 别名]
def createClockDisplayWidgets(self):
"""Create the Clock Display widgets."""
self.tableClockDisplays = gtk.Table(rows=3, columns=3, homogeneous=False)
self.tableClockDisplays.set_row_spacings(5)
self.tableClockDisplays.set_col_spacings(5)
createLabel(self.tableClockDisplays, text="Show", gridX=0, gridY=0, xPadding=10)
self.clockCheckButton = createCheckButton(self.tableClockDisplays, active=True, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred)
createLabel(self.tableClockDisplays, text="Time 1 Format", gridX=0, gridY=1, xPadding=10)
self.clock1Format = createEntry(self.tableClockDisplays, maxSize=50, width=20, text=CLOCK_FMT_1, gridX=1, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.clock1CheckButton = createCheckButton(self.tableClockDisplays, text="Show", active=True, gridX=2, gridY=1, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.registerComponent("time1_format", self.clock1Format)
createLabel(self.tableClockDisplays, text="Time 1 Font", gridX=0, gridY=2, xPadding=10)
self.clock1FontButton = createFontButton(self.tableClockDisplays, font=self.defaults["font"], gridX=1, gridY=2, handler=self.changeOccurred)
self.registerComponent("time1_font", self.clock1FontButton)
createLabel(self.tableClockDisplays, text="Time 2 Format", gridX=0, gridY=3, xPadding=10)
self.clock2Format = createEntry(self.tableClockDisplays, maxSize=50, width=20, text=CLOCK_FMT_2, gridX=1, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.clock2CheckButton = createCheckButton(self.tableClockDisplays, text="Show", active=True, gridX=2, gridY=3, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.registerComponent("time2_format", self.clock2Format)
createLabel(self.tableClockDisplays, text="Time 2 Font", gridX=0, gridY=4, xPadding=10)
self.clock2FontButton = createFontButton(self.tableClockDisplays, font=self.defaults["font"], gridX=1, gridY=4, handler=self.changeOccurred)
self.registerComponent("time2_font", self.clock2FontButton)
createLabel(self.tableClockDisplays, text="Tooltip Format", gridX=0, gridY=5, xPadding=10)
self.clockTooltipFormat = createEntry(self.tableClockDisplays, maxSize=50, width=20, text=CLOCK_TOOLTIP, gridX=1, gridY=5, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.clockTooltipCheckButton = createCheckButton(self.tableClockDisplays, text="Show", active=True, gridX=2, gridY=5, xExpand=True, yExpand=False, handler=self.changeOccurred)
self.registerComponent("clock_tooltip", self.clockTooltipFormat)
self.clockArea = gtk.ScrolledWindow()
self.clockBuf = gtk.TextBuffer()
self.clockTextView = gtk.TextView(self.clockBuf)
self.clockBuf.insert_at_cursor("%H 00-23 (24-hour) %I 01-12 (12-hour) %l 1-12 (12-hour) %M 00-59 (minutes)\n%S 00-59 (seconds) %P am/pm %b Jan-Dec %B January-December\n%a Sun-Sat %A Sunday-Saturday %d 01-31 (day) %e 1-31 (day)\n%y 2 digit year, e.g. 09 %Y 4 digit year, e.g. 2009")
self.clockTextView.set_editable(False)
self.clockArea.add_with_viewport(self.clockTextView)
self.tableClockDisplays.attach(self.clockArea, 0, 3, 6, 7, xpadding=10)
示例3: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TextBuffer [as 别名]
def __init__(self):
filename = 'dndtester.glade'
windowname = 'DNDTester'
self.wTree = gtk.glade.XML(filename, windowname)
self.log_buffer = gtk.TextBuffer()
self.setupWidgets()
示例4: _on_button_more_clicked
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TextBuffer [as 别名]
def _on_button_more_clicked(self, button):
lines = list(self._popup_text_lines)
if (pg.gui.get_label_full_text_width(self._label_message)
> self._label_message.get_allocation().width):
lines.insert(0, self._label_text)
text = "\n".join(lines).strip()
text_buffer = gtk.TextBuffer()
text_buffer.set_text(text.encode(pg.GTK_CHARACTER_ENCODING))
self._text_view_more.set_buffer(text_buffer)
self._popup_more.move(*pg.gui.get_position_below_widget(self))
self._popup_more.show()
示例5: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TextBuffer [as 别名]
def __init__(self):
super(ConsolePanel, self).__init__()
self._history = ['', ] * ConsolePanel.MAX_HISTORY
self._history_i = 0
s_window = gtk.ScrolledWindow()
s_window.set_policy(gtk.POLICY_AUTOMATIC,
gtk.POLICY_AUTOMATIC)
s_window.show()
t_table = gtk.TextTagTable()
tag_out=gtk.TextTag("output")
tag_out.set_property("foreground","blue")
tag_out.set_property("font","monospace 10")
tag_out.set_property("editable", False)
t_table.add(tag_out)
tag_in=gtk.TextTag("input")
tag_in.set_property("foreground","black")
tag_in.set_property("font","monospace 10")
t_table.add(tag_in)
self.tag_table = t_table
self._buffer = gtk.TextBuffer(t_table)
self._view = gtk.TextView(buffer = self._buffer)
self._view.connect("key_press_event", self.actionKeyPress)
self._view.show()
s_window.add(self._view)
self.add(s_window)
evalButton = gtk.Button("Evaluate")
evalButton.connect("clicked", self.evaluateAction, "evaluate")
#evalButton.show()
self.pack_start(evalButton, False, False, 0)
self._evalButton = evalButton
console_info = gtk.Label('')
self._console_info = console_info
self.update_consoleinfo()
console_info.show()
self.pack_start(console_info, False, False, 0)
self.append("> ", "input")
location = self._buffer.get_end_iter()
self._start_mark = self._buffer.create_mark("beginCode",
location, left_gravity=True)
self._firstEnter = False