gtk.TextTag

gtk.TextTag — an object used to apply attributes to text in a gtk.TextBuffer

Synopsis

class gtk.TextTag(gobject.GObject):
    gtk.TextTag(name=None)
def get_priority()
def set_priority(priority)
def event(event_object, event, iter)

Ancestry

+-- gobject.GObject
  +-- gtk.TextTag

Properties

"name"Read-WriteThe name of the texttag or None if anonymous
"background"WriteThe background color as a string
"foreground"WriteThe foreground color as a string
"background-gdk"Read-WriteThe background color as a (possibly unallocated) gtk.gdk.Color
"foreground-gdk"Read-WriteThe foreground color as a (possibly unallocated) gtk.gdk.Color
"background-stipple"Read-WriteThe bitmap to use as a mask when drawing the text background
"foreground-stipple"Read-WriteThe bitmap to use as a mask when drawing the text foreground
"font"Read-WriteThe font description as a string, e.g. "Sans Italic 12"
"font-desc"Read-WriteThe font description as a pango.FontDescription object
"family"Read-WriteThe name of the font family, e.g. Sans, Helvetica, Times, Monospace
"style"Read-WriteThe font style - one of: pango.STYLE_NORMAL, pango.STYLE_OBLIQUE or pango.STYLE_ITALIC.
"variant"Read-WriteThe font variant - either pango.VARIANT_NORMAL or pango.VARIANT_SMALL_CAPS.
"weight"Read-WriteThe font weight as an integer: pango.WEIGHT_ULTRALIGHT = 200, pango.WEIGHT_LIGHT = 300, pango.WEIGHT_NORMAL = 400, pango.WEIGHT_BOLD = 700, pango.WEIGHT_ULTRABOLD = 800, pango.WEIGHT_HEAVY = 900.
"stretch"Read-WriteThe font stretch - one of: pango.STRETCH_ULTRA_CONDENSED, pango.STRETCH_EXTRA_CONDENSED, pango.STRETCH_CONDENSED, pango.STRETCH_SEMI_CONDENSED, pango.STRETCH_NORMAL, pango.STRETCH_SEMI_EXPANDED, pango.STRETCH_EXPANDED, pango.STRETCH_EXTRA_EXPANDED, pango.STRETCH_ULTRA_EXPANDED
"size"Read-WriteThe font size in Pango units.
"size-points"Read-WriteThe font size in points
"scale"Read-WriteThe font size as a scale factor relative to the default font size. This properly adapts to theme changes etc. so is recommended. Pango predefines some scales such as pango.SCALE_XX_SMALL, pango.SCALE_X_SMALL, pango.SCALE_SMALL, pango.SCALE_MEDIUM, pango.SCALE_LARGE, pango.SCALE_X_LARGE, pango.SCALE_XX_LARGE.
"pixels-above-lines"Read-WriteThe number of pixels of blank space above paragraphs
"pixels-below-lines"Read-WriteThe number of pixels of blank space below paragraphs
"pixels-inside-wrap"Read-WriteThe number of pixels of blank space between wrapped lines in a paragraph
"editable"Read-WriteIt TRUE the text can be modified by the user
"wrap-mode"Read-WriteThe wrap mode of the text: gtk.WRAP_NONE, gtk.WRAP_CHAR or gtk.WRAP_WORD
"justification"Read-WriteThe text justification: gtk.JUSTIFY_LEFT, gtk.JUSTIFY_RIGHT, gtk.JUSTIFY_CENTER or gtk.JUSTIFY_FILL
"direction"Read-WriteThe text direction: gtk.TEXT_DIR_NONE, gtk.TEXT_DIR_LTR or gtk.TEXT_DIR_RTL
"left-margin"Read-WriteThe width of the left margin in pixels
"indent"Read-WriteThe amount to indent the paragraph, in pixels
"strikethrough"Read-WriteIf TRUE, strike through the text
"right-margin"Read-WriteThe width of the right margin in pixels
"underline"Read-WriteThe style of underline for this text: pango.UNDERLINE_NONE, pango.UNDERLINE_SINGLE, pango.UNDERLINE_DOUBLE or pango.UNDERLINE_LOW
"rise"Read-WriteThe offset of text above the baseline (below the baseline if rise is negative) in pixels
"background-full-height"Read-WriteIf TRUE, the background color fills the entire line height
"language"Read-WriteThe language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If you don't understand this parameter, you probably don't need it.
"tabs"Read-WriteThe custom tabs for this text
"invisible"Read-WriteIf TRUE, this text is hidden
"background-set"Read-WriteIf TRUE, this tag affects the background color
"foreground-set"Read-WriteIf TRUE, this tag affects the foreground color
"background-stipple-set"Read-WriteIf TRUE, this tag affects the background stipple
"foreground-stipple-set"Read-WriteIf TRUE, this tag affects the foreground stipple
"family-set"Read-WriteIf TRUE, this tag affects the font family
"style-set"Read-WriteIf TRUE, this tag affects the font style
"variant-set"Read-WriteIf TRUE, this tag affects the font variant
"weight-set"Read-WriteIf TRUE, this tag affects the font weight
"stretch-set"Read-WriteIf TRUE, this tag affects the font stretch
"size-set"Read-WriteIf TRUE, this tag affects the font size
"scale-set"Read-WriteIf TRUE, this tag scales the font size by a factor
"pixels-above-lines-set"Read-WriteIf TRUE, this tag affects the number of pixels above lines
"pixels-below-lines-set"Read-WriteIf TRUE, this tag affects the number of pixels above lines
"pixels-inside-wrap-set"Read-WriteIf TRUE, this tag affects the number of pixels between wrapped lines
"editable-set"Read-WriteIf TRUE, this tag affects text editability
"wrap-mode-set"Read-WriteIf TRUE, this tag affects line wrap mode
"justification-set"Read-WriteIf TRUE, this tag affects paragraph justification
"left-margin-set"Read-WriteIf TRUE, this tag affects the left margin
"indent-set"Read-WriteIf TRUE, this tag affects indentation
"strikethrough-set"Read-WriteIf TRUE, this tag affects strikethrough
"right-margin-set"Read-WriteIf TRUE, this tag affects the right margin
"underline-set"Read-WriteIf TRUE, this tag affects underlining
"rise-set"Read-WriteIf TRUE, this tag affects the rise
"background-full-height-set"Read-WriteIf TRUE, this tag affects background height
"language-set"Read-WriteIf TRUE, this tag affects the language the text is rendered as
"tabs-set"Read-WriteIf TRUE, this tag affects tabs
"invisible-set"Read-WriteIf TRUE, this tag affects text visibility

Signal Prototypes

"event" def callback(texttag, widget, event, iter, user_param1, ...)

Description

A gtk.TextTag object holds attributes that can be applied to a range of text in a gtk.TextBuffer. A texttag can be associated with more than one gtk.TextBuffer by adding it to the gtk.TextTagTable objects of the textbuffers. The attributes of a texttag can be set using the GObject.set_property() method or as part of texttag creation using the gtk.TextBuffer.create_tag() method. Since not every attribute property of a gtk.TextTag may be set each attribute property has a boolean property that indicates whether the attribute property is set by this texttag. Therefore before retrieving an attribute value from a texttag you have to check if the associated boolean property of the attribute property is TRUE.

Constructor

    gtk.TextTag(name=None)
name :tag name, or None if the texttag is anonymous
Returns :a new gtk.TextTag

Creates a gtk.TextTag with the name specified by name. If name is None the texttag will be anonymous. The texttag attributes are configured using the GObject.set_property() method.

Methods

gtk.TextTag.get_priority

    def get_priority()
Returns :the texttag's priority.

The get_priority() method returns the priority or the texttag.

gtk.TextTag.set_priority

    def set_priority(priority)
priority :the new priority

The set_priority() method sets the priority of a gtk.TextTag to the value specified by priority. Valid priorities start at 0 and go to one less than the value returned by the gtk.TextTagTable.get_size() method. Each texttag in a table has a unique priority; setting the priority of one texttag shifts the priorities of all the other texttags in the table to maintain a unique priority for each texttag. Higher priority tags "win" if two texttags both set the same text attribute for a range of text. When adding a texttag to a gtk.TextTagTable, it will be assigned the highest priority in the table by default; so normally the precedence of a set of texttags is the order in which they were added to the table, or created with the gtk.TextBuffer.create_tag() method, that adds the texttag to the buffer's table automatically.

gtk.TextTag.event

    def event(event_object, event, iter)
event_object :the object that received the event, such as a widget
event :the event
iter :the location where the event was received
Returns :the result of signal emission (whether the event was handled)

The event() method emits the "event" signal on the gtk.TextTag for the widget specified by event_object with the event specified by event at the textbuffer location specified by iter. This method returns TRUE if the event was handled.

Signals

The "event" gtk.TextTag Signal

    def callback(texttag, widget, event, iter, user_param1, ...)
texttag :the texttag that received the signal
widget :the widget that received event
event :the event
iter :the gtk.TextIter pointing to the location where the event was received
user_param1 :the first user parameter (if any) specified with the connect() method
... :additional user parameters (if any)

The "event" signal is emitted when an event occurs in a range of text that is enclosed in the texttag. The widget that the event occurred in is specified by widget. iter holds the location that the event occurred at and event describes the event.