Re: [PyKDE] Listbox returns dictionary key?

2003-08-14 Thread Peter Clark
On Wednesday 06 August 2003 10:44 pm, Gordon Tyler wrote: > Looking at http://doc.trolltech.com/3.1/qlistbox.html, it seems you could > use the "selected(const QString &)" signal. Ah-ha! I actually tried that, but I made a mistake; on the analogy of "selected(int)", I tried omitting the "Q

Re: [PyKDE] Listbox returns dictionary key?

2003-08-14 Thread Gordon Tyler
On August 7, 2003 12:13 am, Peter Clark wrote: > Ah-ha! I actually tried that, but I made a mistake; on the analogy of > "selected(int)", I tried omitting the "QString &" part. So is it only safe > to omit "index"? The documentation has the following: > > void selected ( int index ) > void se

[PyKDE] Listbox returns dictionary key?

2003-08-14 Thread Peter Clark
Let's say I want to populate a listbox with a list of dictionary keys: d = {'cat':'Fluffy', 'dog':'Wolfie'} k = d.keys() k.sort() At this point, I've got a listbox with two items: cat dog Now, self.connect(self.listBox, SIGNAL("selected(int)"), self.pr

Re: [PyKDE] Listbox returns dictionary key?

2003-08-09 Thread Gordon Tyler
On August 6, 2003 11:31 pm, Peter Clark wrote: > self.connect(self.listBox, SIGNAL("selected(int)"), > self.printWhatWeSelected) > > returns '0' if I select cat, '1' for 'dog', etc. To get the dictionary > value for that selection, I could do > > d[k[int]] > > but this requires that I pass both d a