I have problems  creating a read-only tag in gtk.TextBuffer.

I have the following information:

1) from the API documentation of gtk.TextView:

gtk.TextView.set_editable
    def set_editable(setting)
setting : whether it's editable

Sets the default editability of the gtk.TextView. You can override this default 
setting with tags in the buffer, using the "editable" attribute of tags.

So I have to change the editable atribute of my tag.

2) from the API documentation of gtk.TextTag:
Constructor
    def __init__(name)
name : tag name, or NULL
Returns : a new gtk.TextTag

Creates a gtk.TextTag. Configure the tag using object arguments, i.e. using 
g_object_set(). 

3) From the API documentation of gtk.TextBuffer:
gtk.TextBuffer.create_tag
    def create_tag(tag_name, first_property_name)
tag_name : name of the new tag, or NULL
first_property_name : name of first property to set, or NULL
Returns : a new tag

Creates a tag and adds it to the tag table for buffer. Equivalent to calling 
gtk.TextTag() and then adding the tag to the buffer's tag table. The returned tag is 
owned by the buffer's tag table, so the ref count will be equal to one.
If tag_name is NULL, the tag is anonymous.
If tag_name is non-NULL, a tag called tag_name must not already exist in the tag table 
for this buffer.
The first_property_name argument and subsequent arguments are a list of properties to 
set on the tag, as with g_object_set()

If I understand this well 3) contradicts 2) and is incorrect. It says that you can 
give more than a single parameter to the constructor, which is not true.

I can create a tag using
        self.Buffer.ReadOnly=self.Buffer.create_tag('ReadOnly')

But when I check whether it is editable using:
        self.Buffer.ReadOnly.get_property('readonly')
python complains:
        TypeError: the object does not support the given parameter

What am I doing wrong? And where can I find a list of tag properties that I can change?

Bye,

Martijn

_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to