Thanks for bogdan.galiceanu's help,now I have a skeleton of UI.
but I have a further question, as the following codes, I have a initial window "Listbox",and the second window "Canvas". The "Canvas" shows the realtime data. I want to implement a "back" not "quit" key on the canvas' right softkey.
How to do ?
Thanks
Code:#-*- coding: UTF-8 -*- import appuifw import time # import graphics from graphics import * def quit(): running = 0 t.cancel() app_lock.signal() # define a callback function def shout(): index = lb.current() if index ==0: global img,canvas,mytimer canvas=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw) appuifw.app.directional_pad = False # define an initial image (white) img=Image.new(canvas.size) img.text((100,80), u'') update_data() if index == 1: pass if index ==2: pass if index ==3: pass # define your redraw function (that redraws the picture on and on) # in this case we redraw the image named img using the blit function def handle_redraw(rect): img.clear() img.line((20,20,20,120),0xff00ee) img.text((100,80), str1,fill = 0x0,font='normal') canvas.blit(img) flag = 1 str1 = '' def update_data(): global flag,str1 if flag == 1: str1 = u'good' flag =0 else: str1 = u'bad' flag =1 handle_redraw(()) t.after(10,update_data) if __name__ == "__main__": import e32 app_lock =e32.Ao_lock() appuifw.app.exit_key_handler = quit t = e32.Ao_timer() appuifw.app.title = u'Listbox_canvas' # create your content list of your listbox including the icons to be used for each entry entries = [u'canvas_test',u'item1',u'item2',u'item3'] lb = appuifw.Listbox(entries,shout) # create an instance of appuifw.Listbox(), include the content list "entries" and the callback function "shout" # and set the instance of Listbox now as the application body appuifw.app.body = lb app_lock.wait()

Reply With Quote


