[pygtk] trouble with comboboxentry

Kim Novak kim at trdlnk.com
Thu Nov 16 23:49:01 WST 2006


An example is in the FAQ: 
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq16.008.htp

Pascal Duchatelle wrote:
> 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
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


More information about the pygtk mailing list