From: Kevin A. <al...@se...> - 2004-09-12 16:54:29
|
On Sep 12, 2004, at 9:40 AM, Gregory Pi=F1ero wrote: > Actually, it seems to only happen with numbers as items. Also I typed=20= > them as [1,2,3] in the resource editor field. Maybe it's required to=20= > do, ['1','2','3'] ? > > -Greg > > > Gregory Pi=F1ero wrote: > >> Minor bug? Maybe this was already fixed in the latest version? =20 >> Below is the code generated by the resource editor. You can use it=20= >> to replicate the bug, but any example should work. >> -Greg >> Version Info: >> PythonCard version: 0.8 >> wxPython version: 2.5.2.7 >> Python version: 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit=20= >> (Intel)] >> Platform: win32 >> {'application':{'type':'Application', >> 'name':'Template', >> 'backgrounds': [ >> {'type':'Background', >> 'name':'bgTemplate', >> 'title':'Standard Template with no menus', >> 'position':(198, 198), >> 'size':(490, 582), >> 'components': [ >> {'type':'Choice', >> 'name':'Choice1', >> 'position':(118, 78), >> 'size':(130, -1), >> 'backgroundColor':(255, 128, 255), >> 'foregroundColor':(0, 0, 255), >> 'items':['1', '2', '3', '4', '5', '6'], >> }, >> ] # end components >> } # end background >> ] # end backgrounds >> } } >> You didn't say what the bug was before, but I assume you mean that the=20= items in the list are strings? If so, yes, the items in the list must=20 be strings for all the components that have an items list attribute.=20 Use str() and int() to convert back and forth in your code if you need=20= to work with integers internally, but display them as strings in the=20 components. If you wanted to use stringSelection to select the item '3' in the list=20= then you would do something like: self.components.Choice1.stringSelection =3D '3' but if you wanted to select the item by its numeric position in the=20 list, remember to use an integer as well as that the list is=20 zero-based, like most things in Python. self.components.Choice1.selection =3D 2 ka= |