Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Working with both Text and Canvas (See related posts)

In some applications, you need to write some code
in the input text, while the result is display on
a canvas display. For PC apps, you can just make
a two-pane display.

On pys60, however, the phone can display only
either a Canvas, a Text or a Listbox at the same time.
You cannot use two-pane interface.

The following code works around this by switching
between two displays.
from appuifw import *
import e32
sleep = e32.ao_sleep

t = Text()
c = Canvas()

running = 1
def quit():
    global running
    running = 0
app.exit_key_handler = quit

while running:
    app.body = t
    sleep(5)
    # show result
    app.body = c
    c.clear()
    c.text((10, 50), t.get())
    sleep(0.5)

You need to create an account or log in to post comments to this site.


Click here to browse all 4860 code snippets

Related Posts