[pygtk] how to load values one by one selecting from database in combobox of glade file?
anusha k
anuhacks at gmail.com
Mon Apr 13 21:52:51 WST 2009
hi
just give
for i in range(*0*,len(self.text)): instead of for i in
range(len(self.text)):
The simple to do this is:
def loadlist(self):
self.text= self.con.getSelectionlist()
for i in range(0,len(self.text)):
self.combobox.append_text(self.text[i])
Njoy the share of Freedom,
Anusha Kadambala
On Mon, Apr 13, 2009 at 6:10 PM, ganesh gajare
<gnowledge.ganesh at gmail.com>wrote:
> Hello,
>
> We are trying to load list values from database into our combobox widget
> which we created using glade.
>
> def loadlist(self):
> self.text= self.con.getSelectionlist()
> print "List: %s " %self.text
> for i in range(len(self.text)):
> print i,self.text[i].keys()
> print len(self.text[i].values())
> self.val=self.text[i].values()
> return self.val[1]
>
> The above function will iterate through the list and will return the list
> values to the calling function given below:
>
> self.l=self.db.loadlist()
> self.sel.get_widget('lists').append_text(self.l)
>
> Now, if the return statement is inside for loop ...then the value getting
> passed is only the first list value.
> and if the return statement is outside the for loop...then the last list
> value is passed to the calling function.
>
> Our main aim is to pass the individual list elements one by one and append
> them to the combobox widget.
>
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090413/411527b1/attachment.htm
More information about the pygtk
mailing list