gtk.TextTag — an object used to apply attributes to text in a gtk.TextBuffer
class gtk.TextTag( |
|
"event" | def callback( |
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
()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
.
gtk.TextTag(name
=None)
| 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
()
def get_priority()
Returns : | the texttag's priority. |
The get_priority() method returns the priority or the texttag.
def set_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.
def event(event_object
, event
, iter
)
| the object that received the event, such as a widget |
| the event |
| 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.
def callback(texttag
, widget
, event
, iter
, user_param1
, ...
)
| the texttag that received the signal |
| the widget that received
event |
| the event |
| the gtk.TextIter
pointing to the location where the event was received |
| the first user parameter (if any) specified
with the connect () |
| 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.