Canvas

#Canvas
#The application's body can be set to Canvas, which is used mainly for displaying images


import appuifw, graphics, e32

#Define the exit function
def quit():
app_lock.signal()
appuifw.app.exit_key_handler=quit

#We define a method that will place the image myimage on the canvas:
def handle_redraw(rect):
c.blit(myimage)

#We open myimage
myimage=graphics.Image.open("C:\\myimage.jpg")

#or we make a blank one, specifying its size in pixels
myimage=graphics.Image.new((240,320))
c=appuifw.Canvas(event_callback=None, redraw_callback=handle_redraw)

#This sets c as a canvas which can be redrawn and can be modified if certain events (in this case key presses) occur if you make a method for that
appuifw.app.body=c
c.text((20,30), u"something", font="title")

#Here the text is displayed at the specified coordinates on the canvas, with the title font, if the 1 button is pressed
#Other font types are normal, default, dense, symbol, annotation, and legend. You can also use other formats, as is explained below

#As you've seen above, you can write text on a canvas.
#An additional way of specifying the parameters is:
c.text((2,24), u'Hello', 0x008000, font=(u'Nokia Hindi S60',48,appuifw.STYLE_BOLD))

#Here 0x008000 is the color of the text, 48 is its size and appuifw.STYLE_BOLD is its style
#The canvas can also be cleared (and optionally filled with a color)
c.clear()

#c.clear(0x008000) fills it with green
app_lock=e32.Ao_lock()

app_lock.wait()