Re: List components
Steven D'Aprano <[email protected]> Wed, 18 Sep 2013 14:32:57 +1000
| Newsgroups | gmane.comp.python.pythoncard |
|---|---|
| Message-ID | <20130918043257.GA1202@ando> |
On Wed, Sep 18, 2013 at 03:42:46AM +0000, Azam, Naweed wrote: > Hello, > > I have a question about list components. When I try to specify text > to appear in a List box, each character appears on a line alone and > nothing shows up in the stringSelection drop down box. I'm not an expert on Pythoncard, but given the description of the error, I would try passing the list of movie titles directly rather than a single string. E.g. instead of: # clips is a list of movie titles self.components.List1.items = str(clips) I would use this: self.components.List1.items = clips This assumes that each movie title is a string. Calling str() on a list of strings gives you a single string: py> clips = ['Warm Bodies', 'Gone With The Wind', 'Alien'] py> str(clips) "['Warm Bodies', 'Gone With The Wind', 'Alien']" and then iterating over that string gives you individual characters, including those from the list itself: py> for element in str(clips): ... print element ... [ ' W a r m [... snip long output ...] Does this help? -- Steven ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk