[pygtk] pango markup in a liststore

Thomas Mills Hinkle tmhinkle at gmail.com
Wed Oct 4 23:51:52 WST 2006


>From your example code, I can't see what's going on. I whipped up an examp=
le
to try to reproduce your problem, but I had no trouble creating multiple
columns that worked. Can you see if the following code works for you?
Assuming it does, then I'm guessing there's a typo or something in your
code... try to create a small, complete chunk of example code that
demonstrates your problem. If you can create the example but still can't
find your error, send it to the list and maybe someone here can spot the
error.

Tom

import string
import gtk

# Create a two-column list-store
ls =3D gtk.ListStore(str,str)

# Populate our list with markup.


for letter in string.letters[:26]:
    ls.append(('%s<sub>%s</sub> <i>foo</i>'%(letter.upper(),letter),
              '%s<sup>%s</sup> <b>bar</b>'%(letter.upper(),letter))
              )

view =3D gtk.TreeView( ls )
renderer =3D gtk.CellRendererText()
column1 =3D gtk.TreeViewColumn("Pango Markup", renderer, markup=3D0)
column2 =3D gtk.TreeViewColumn("Pango Markup 2",renderer,markup=3D1)
view.append_column(column1)
view.append_column(column2)

w =3D gtk.Window()
sw =3D gtk.ScrolledWindow()
sw.add(view)
w.add(sw)
w.connect('delete-event',gtk.main_quit)
w.show_all()
gtk.main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061004/2a11c741/at=
tachment.htm


More information about the pygtk mailing list