Using Modules
The native UI elements that PyS60 offers are accessible through a modulecalled appuifw (which stands for application user interface framework).
It is an interface to the S60 UI application framework that takes care of
all UI functionalities on the S60 platform. But before we go on, let’s learn
what a ‘module’ is in Python, in the language lesson.
Python Language Lesson: module
A module is a file that contains a collection of related functions and datagrouped together. PyS60 comes with a rich set of modules, for example
messaging to handle SMS functionalities, camera for taking photos,
and appuifw,which provides ready-to-use UI elements. The modules’
contents are described in detail in the Python Library Reference and
Python for S60 API documentation. We also learn about many of them
in this book.
To use a module in your code, it must be imported at the beginning
of the script, for example:
import appuifw
To address a function contained in a module, we first write the
module name, a dot and then the function name:
appuifw.query(label, type)
Here, appuifw is the module name and query is the function we
want to use.
You may import many modules using a single import statement:
import appuifw, e32
This imports two modules: appuifw and e32.
No comments:
Post a Comment