Now I use the GUI my application.
So I want to know how I open the window options (Setting), which includes Tabs in it.
See code:
Code:
import appuifw
import e32
from graphics import *
import camera
import key_codes
import graphics
im_1 =graphics.Image.open('e:\\python\\resources\\ui\\img_1.jpg')
im_2 =graphics.Image.open('e:\\python\\resources\\ui\\img_2.jpg')
im_3 =graphics.Image.open('e:\\python\\resources\\ui\\img_3.jpg')
im_4 =graphics.Image.open('e:\\python\\resources\\ui\\img_4.jpg')
photo = im_1
def press_down():
global photo
if photo == im_1:
photo = im_3
elif photo == im_2:
photo = im_4
canvas.blit(photo)
def press_up():
global photo
if photo == im_3:
photo = im_1
elif photo == im_4:
photo = im_2
canvas.blit(photo)
def press_right():
global photo
if photo == im_1:
photo = im_2
elif photo == im_3:
photo = im_4
canvas.blit(photo)
def press_left():
global photo
if photo == im_2:
photo = im_1
elif photo == im_4:
photo = im_3
canvas.blit(photo)
def press_select():
global photo
if photo == im_1:
appuifw.note(u"Videos", "info")
elif photo == im_2:
appuifw.note(u"Libraries", "info")
elif photo == im_3:
appuifw.note(u"Music", "info")
elif photo == im_4:
appuifw.note(u"Pictures ", "info")
canvas.blit(photo)
def handle_redraw(rect):
global photo
canvas.blit(photo)
# menu
def about():
appuifw.note(u"Vnixe Player Version 0.1 Alpha - Visit At www.vnixe.net ", "info")
def quit():
app_lock.signal()
#submenu
def update():
print ""
round.set(u'Chack for Update one was selected')
def credit():
print ""
round.set(u'Credits two was selected')
def feedback():
round.set(u'Send Feedback three was selected')
def english():
print ""
round.set(u'Englise four was selected')
def language2():
print ""
round.set(u'language2 was selected')
def add_skin():
print ""
round.set(u'Add Skin was selected')
def add_lang():
print ""
round.set(u'Add Lang was selected')
def add_plug():
print ""
round.set(u'Add Plug-in was selected')
def exit_key_handler():
app_lock.signal()
def show_tabs():
# create the tabs with its names in unicode as a list, include the tab handler
appuifw.app.set_tabs([u"General", u"Setting", u"Advance"],handle_tab)
# set the title of the script
appuifw.app.title = u'Setting'
# set app.body to app1 (for start of script)
appuifw.app.body = app1
# create a tab handler that switches the application based on what tab is selected
def handle_tab(index):
global lb
if index == 0:
appuifw.app.body = app1 # switch to application 1
if index == 1:
appuifw.app.body = app2 # switch to application 2
if index == 2:
appuifw.app.body = app3 # switch to application 3
canvas=appuifw.Canvas(redraw_callback=handle_redraw)
appuifw.app.body=canvas
canvas.bind(key_codes.EKeySelect, press_select)
canvas.bind(key_codes.EKeyDownArrow, press_down)
canvas.bind(key_codes.EKeyUpArrow, press_up)
canvas.bind(key_codes.EKeyRightArrow, press_right)
canvas.bind(key_codes.EKeyLeftArrow, press_left)
canvas.blit(photo)
# create the application menu including submenus
appuifw.app.menu = [(u"Option", ((u"Chack for update", update),
(u"Add Plug-in", add_plug),
(u"Add Skin", add_skin),
(u"Add Language", add_lang),
(u"Send Feedback", feedback),
(u"Credits", credit))),
(u"Language", ((u"English", english),
(u"language2", language2))),
(u"Setting", show_tabs),
(u"About", about)]
appuifw.app.exit_key_handler=quit
appuifw.app.screen='full'
appuifw.app.title = u"Venix Player"
appuifw.app.exit_key_handler = quit
app_lock = e32.Ao_lock()
app_lock.wait()
# define application 1: text app
app1 = appuifw.Text(u'Appliation o-n-e is on')
# define application 2: text app
app2 = appuifw.Text(u'Appliation t-w-o is on')
# define application 3: text app
app3 = appuifw.Text(u'Appliation t-h-r-e-e is on')