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

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Open another app as content handler

Current python for series 60 (version 1) doesn't support graphics drawing on screen. But it still allows you to open an image file or other content file using external content handler. Here is the short and shorter versions to demonstrate.

# this version wait for external app to exit, then it continue.
import e32
lock = e32.Ao_lock()
handler = appuifw.Content_handler(lock.signal)
hander.open(filename)  # eg. an image file
lock.wait()	# wait for lock.signal to unlock

# this is a short, one-line version which doesn't wait
appuifw.Content_handler().open(filename)

Read remote content

Reading remote data is easy in python.

from urllib import *
url = 'http://example.com/index.html'
html = urlretrieve(url).read()
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS