I'm not sure what I was doing wrong, but when I tried to create a simple example, it worked:
Code:
from appuifw import *
import e32
class lbfun:
def __init__(self):
self.categories = [u'Pets', u'Colors']
self.listcats()
self.where= 'cat'
def listcats(self):
self.catslb = Listbox(self.categories, self.choosecat)
app.body = self.catslb
app.menu = [(u'Choose category', self.choosecat)]
self.where = 'cat'
def choosecat(self):
currentcat = self.catslb.current()
if currentcat == 0:
self.items = [u'cats', u'dogs', u'goldfish']
if currentcat == 1:
self.items = [u'red', u'blue', u'green']
self.itemslb = Listbox(self.items, self.itemfunc)
app.body = self.itemslb
app.menu = [(u'Show', self.itemfunc)]
self.where = 'item'
def itemfunc(self):
pos = self.itemslb.current()
note(u'%s' % self.items[pos])
def exit_hand(self):
if self.where == 'cat':
lock.signal()
elif self.where == 'item':
self.listcats()
x = lbfun()
lock = e32.Ao_lock()
app.exit_key_handler = x.exit_hand
lock.wait()