DZone 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

Snippets has posted 5883 posts at DZone. View Full User Profile

Working With Both Text And Canvas

08.11.2005
| 4848 views |
  • submit to reddit
        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)