17. Using the Yocto-Display with Python
Python is an interpreted object oriented language developed by Guido van Rossum. Among its
advantages is the fact that it is free, and the fact that it is available for most platforms, Windows as
well as UNIX. It is an ideal language to write small scripts on a napkin. The Yoctopuce library is
compatible with Python 2.6+ and 3+. It works under Windows, Mac OS X, and Linux, Intel as well as
ARM. The library was tested with Python 2.6 and Python 3.2. Python interpreters are available on the
Python web site
1
.
17.1. Source files
The Yoctopuce library classes
2
for Python that you will use are provided as source files. Copy all the
content of the
Sources
directory in the directory of your choice and add this directory to the
PYTHONPATH
environment variable. If you use an IDE to program in Python, refer to its
documentation to configure it so that it automatically finds the API source files.
17.2. Dynamic library
A section of the low-level library is written in C, but you should not need to interact directly with it: it is
provided as a DLL under Windows, as a
.so
files under UNIX, and as a
.dylib
file under Mac OS X.
Everything was done to ensure the simplest possible interaction from Python: the distinct versions of
the dynamic library corresponding to the distinct operating systems and architectures are stored in
the
cdll
directory. The API automatically loads the correct file during its initialization. You should not
have to worry about it.
If you ever need to recompile the dynamic library, its complete source code is located in the
Yoctopuce C++ library.
In order to keep them simple, all the examples provided in this documentation are console
applications. Naturally, the libraries function in a strictly identical manner if you integrate them in an
application with a graphical interface.
17.3. Control of the Display function
A few lines of code are enough to use a Yocto-Display. Here is the skeleton of a Python code
snipplet to use the Display function.
1
http://www.python.org/download/
2
www.yoctopuce.com/EN/libraries.php
www.yoctopuce.com
101
Содержание Yocto-Display
Страница 1: ...Yocto Display User Manual...
Страница 2: ......
Страница 40: ...34 www yoctopuce com...
Страница 52: ...46 www yoctopuce com...
Страница 84: ...78 www yoctopuce com...
Страница 92: ...86 www yoctopuce com...
Страница 130: ...124 www yoctopuce com...
Страница 158: ...22 High level API Reference 152 www yoctopuce com On failure throws an exception or returns a negative error code...
Страница 422: ...416 www yoctopuce com...
Страница 424: ...24 Characteristics 418 www yoctopuce com...