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

gtk.TextTag Properties

"background"WriteThe background color as a string
"background-full-height"Read-WriteIf TRUE, the background color fills the entire line height
"background-full-height-set"Read-WriteIf TRUE, this tag affects background height
"background-gdk"Read-WriteThe background color as a (possibly unallocated) gtk.gdk.Color
"background-set"Read-WriteIf TRUE, this tag affects the background color
"background-stipple"Read-WriteThe bitmap to use as a mask when drawing the text background
"background-stipple-set"Read-WriteIf TRUE, this tag affects the background stipple
"direction"Read-WriteThe text direction: gtk.TEXT_DIR_NONE, gtk.TEXT_DIR_LTR or gtk.TEXT_DIR_RTL
"editable"Read-WriteIt TRUE the text can be modified by the user
"editable-set"Read-WriteIf TRUE, this tag affects text editability
"family"Read-WriteThe name of the font family, e.g. Sans, Helvetica, Times, Monospace
"family-set"Read-WriteIf TRUE, this tag affects the font family
"font"Read-WriteThe font description as a string, e.g. "Sans Italic 12"
"font-desc"Read-WriteThe font description as a pango.FontDescription object
"foreground"WriteThe foreground color as a string
"foreground-gdk"Read-WriteThe foreground color as a (possibly unallocated) gtk.gdk.Color
"foreground-set"Read-WriteIf TRUE, this tag affects the foreground color
"foreground-stipple"Read-WriteThe bitmap to use as a mask when drawing the text foreground
"foreground-stipple-set"Read-WriteIf TRUE, this tag affects the foreground stipple
"indent"Read-WriteThe amount to indent the paragraph, in pixels
"indent-set"Read-WriteIf TRUE, this tag affects indentation
"invisible"Read-WriteIf TRUE, this text is hidden
"invisible-set"Read-WriteIf TRUE, this tag affects text visibility
"justification"Read-WriteThe text justification: gtk.JUSTIFY_LEFT, gtk.JUSTIFY_RIGHT, gtk.JUSTIFY_CENTER or gtk.JUSTIFY_FILL
"justification-set"Read-WriteIf TRUE, this tag affects paragraph justification
"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.
"language-set"Read-WriteIf TRUE, this tag affects the language the text is rendered as
"left-margin"Read-WriteThe width of the left margin in pixels
"left-margin-set"Read-WriteIf TRUE, this tag affects the left margin
"name"Read-WriteThe name of the texttag or None if anonymous
"paragraph-background"WriteThe paragraph background color as a string. This property is available in GTK+ 2.8 and above.
"paragraph-background-gdk"Read-WriteThe paragraph background color as a as a (possibly unallocated) gtk.gdk.Color. This property is available in GTK+ 2.8 and above.
"paragraph-background-set"Read-Writeif TRUE this tag affects the paragraph background color
"pixels-above-lines"Read-WriteThe number of pixels of blank space above paragraphs
"pixels-above-lines-set"Read-WriteIf TRUE, this tag affects the number of pixels above lines
"pixels-below-lines"Read-WriteThe number of pixels of blank space below paragraphs
"pixels-below-lines-set"Read-WriteIf TRUE, this tag affects the number of pixels above lines
"pixels-inside-wrap"Read-WriteThe number of pixels of blank space between wrapped lines in a paragraph
"pixels-inside-wrap-set"Read-WriteIf TRUE, this tag affects the number of pixels between wrapped lines
"right-margin"Read-WriteThe width of the right margin in pixels
"right-margin-set"Read-WriteIf TRUE, this tag affects the right margin
"rise"Read-WriteThe offset of text above the baseline (below the baseline if rise is negative) in pixels
"rise-set"Read-WriteIf TRUE, this tag affects the rise
"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.
"scale-set"Read-WriteIf TRUE, this tag scales the font size by a factor
"size"Read-WriteThe font size in Pango units.
"size-points"Read-WriteThe font size in points
"size-set"Read-WriteIf TRUE, this tag affects the font size
"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
"stretch-set"Read-WriteIf TRUE, this tag affects the font stretch
"strikethrough"Read-WriteIf TRUE, strike through the text
"strikethrough-set"Read-WriteIf TRUE, this tag affects strikethrough
"style"Read-WriteThe font style - one of: pango.STYLE_NORMAL, pango.STYLE_OBLIQUE or pango.STYLE_ITALIC.
"style-set"Read-WriteIf TRUE, this tag affects the font style
"tabs"Read-WriteThe custom tabs for this text
"tabs-set"Read-WriteIf TRUE, this tag affects tabs
"underline"Read-WriteThe style of underline for this text: pango.UNDERLINE_NONE, pango.UNDERLINE_SINGLE, pango.UNDERLINE_DOUBLE or pango.UNDERLINE_LOW
"underline-set"Read-WriteIf TRUE, this tag affects underlining
"variant"Read-WriteThe font variant - either pango.VARIANT_NORMAL or pango.VARIANT_SMALL_CAPS.
"variant-set"Read-WriteIf TRUE, this tag affects the font variant
"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.
"weight-set"Read-WriteIf TRUE, this tag affects the font weight
"wrap-mode"Read-WriteThe wrap mode of the text: gtk.WRAP_NONE, gtk.WRAP_CHAR or gtk.WRAP_WORD
"wrap-mode-set"Read-WriteIf TRUE, this tag affects line wrap mode

gtk.TextTag Signal Prototypes

gobject.GObject 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.