[pygtk] trouble with comboboxentry

Pascal Duchatelle pduchatelle at yahoo.fr
Thu Nov 16 16:48:37 WST 2006


Hello,

I wish to use a comboxentry with file directories in the dropdown list.
when I use the follwing code it works.

dirname = os.path.expanduser('~/tmp')
files = [f for f in os.listdir(dirname) if f[0] <> '.']
files1=[[item] for item in files]

ls=gtk.ListStore(str)
for item in files1:
    ls.append(item)

w = gtk.Window()
cbbe = gtk.ComboBoxEntry(ls, 0)
w.add(cbbe)
w.connect('delete-event',gtk.main_quit)
w.show_all()
gtk.main()

The problem comes when I use glade. I generated basically the same 
window but the content of the combo dropdown list is empty and when I 
fill it in a script (using the above script) it does not work.
Even when I use the following

self.cbbe.set_text_column(0)
self.cbbe.set_model(ls)

the window is displayed correctly, the dropdown list drops down with
apparently the right number of lines but they are empty.
I guess I did something wrong with glade but I don't see what it could be.
Maybe I should leave an empty space in the VBox used in glade and put 
the cbb in it with the script and not just populate it (?!).
Has anyone any idea on this ?

thank you

Pascal





	

	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com


More information about the pygtk mailing list