[pygtk] treeview markup entries and interactive search
t.evans at aranz.com
Thu Aug 21 07:21:46 WST 2008
Tasos Latsas wrote:
> I tried it but unfortunately the normal and bold entries are in the same
> column, so I need the tags...:( Looks like I'll use the extra-column
> Thanx anyway!!
> Tim Evans wrote:
>> gtk.CellRendererText has separate properties for changing font
>> attributes. In the case you describe you would set the "weight"
>> property to pango.WEIGHT_BOLD and just use "text" rather than "markup".
>> Unless you need to change the font attributes mid-way through the text
>> using the specific attributes will be a little faster than markup and
>> won't interfere with searching.
Sorry, I think I didn't explain that very well. Here's an example instead:
model = gtk.ListStore(str, int)
view = gtk.TreeView(model)
view.insert_column_with_attributes(0, 'Title', gtk.CellRendererText(),
The first *model column* is the text, the second is the font weight.
The *view* contains only a single column, but it's attached to both
model columns to set the text and weight used by the cell renderer.
Applied Research Associates NZ
More information about the pygtk