Create a selection list in PyS60


Creating a selection list for my software - 'DSE Stock Tracker' was very important task. It will show the list of companies of Dhaka Stock Exchange. So for demo I tried to create a list of four companies. Here is the code:

import appuifw

L = ['DHAKABANK', 'AIMS1STMF', 'EXIMBANK', 'TRUSTBANK']
index = appuifw.selection_list(choices=L , search_field=1)

I tried to run the program but got the following error:
SymbianError: [Errno -6] KErrArgument
Oh, I forgot to add the 'u' (u for unicode) before each string. So I changed my code and it works.

import appuifw

L = [u'DHAKABANK', u'AIMS1STMF', u'EXIMBANK', u'TRUSTBANK']
index = appuifw.selection_list(choices=L , search_field=1)

Now, as there are hundreds of companies, it's not wise to write every name in the code. So the next to-do is load the list from a file.

Comments

Popular posts from this blog

Strip HTML tags using Python

lambda magic to find prime numbers

Convert text to ASCII and ASCII to text - Python code