Hi folks
I'm trying to populate a combobox with the lines showing in a textview
widget. My question is how do I do this?
I've a textview widget called 'divisions'. This coding reads its
associated buffer:
textbuffer = cbc['divisions'].get_buffer()
divisions =
cbc['divisions'].get_buffer().get_text(*textbuffer.get_bounds())
If the lines in textview are:
First line
Second line
Then divisions contains all these characters including \n.
This coding creates one character entries in the combobox called
divisonsCB:
store = gtk.ListStore(str)
for i in divisions:
if i != '\n' : store.append(i)
cbc['divisionCB'].set_model(store)
cell = gtk.CellRendererText()
cbc['divisionCB'].pack_start(cell, True)
cbc['divisionCB'].add_attribute(cell, 'text', 0)
Can someone help me think logically on this issue please?
Thanks Brian
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/