diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2013-05-11 15:05:36 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2013-05-11 15:07:45 +0200 |
commit | e0036449187bcdb0ba6051c3dd7a0da2b85b9a3f (patch) | |
tree | 4829ac8d91725c67eca5826a1587b23577b4d96f /content/Informatique/wiimote.rst | |
parent | ff7677d13a0037d65c1ac96aea4858d79eff87fb (diff) |
Added translation for article about wiimote
Diffstat (limited to 'content/Informatique/wiimote.rst')
-rw-r--r-- | content/Informatique/wiimote.rst | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/content/Informatique/wiimote.rst b/content/Informatique/wiimote.rst index 019d9f2..eb6641d 100644 --- a/content/Informatique/wiimote.rst +++ b/content/Informatique/wiimote.rst @@ -7,6 +7,8 @@ Controling the wiimote (I) :date: 2009-03-11 :tags: Programmation, Wiimote, Python +:slug: controling-the-wiimote-i +:lang: en Creating the plugin for wminput @@ -27,7 +29,7 @@ You can get it here : About the code : -:: +.. code-block:: python import wmplugin @@ -35,7 +37,7 @@ This import does not exist, but is created by wminput when executed. It provide the connexion with the wminput core. Just put ( or link ) the script in the wminput plugin path ( on my debian this is the /usr/lib/cwiid/plugins/ ) -:: +.. code-block:: python def wmplugin_init(id, wiimote_arg): wmplugin.set_rpt_mode(id, cwiid.RPT_IR | cwiid.RPT_BTN) @@ -56,7 +58,7 @@ you can get the signification of all the parameters here : `actions list If we want to define new butons, we just have to name them in the first list, the'll be accessible in the configuration file as plugin.[buton\_name] = ACTION -:: +.. code-block:: python def wmplugin_exec(messages): '''Wiimote callback managing method @@ -81,7 +83,7 @@ way for passing throught is to use global variables. But it is unelegant and can cause problems if we want to use our code in imports. So we'ill use a list as default parameter and let python save it as you can see here : -:: +.. code-block:: python >>> def meth(a=[]): ... a.append(1) @@ -97,7 +99,7 @@ as default parameter and let python save it as you can see here : So the ir\_sensor.get\_movement method is defined with each parameter we want to save as an optional list -:: +.. code-block:: python def get_movement(msg, _old_points=[], _old_position = [0, 0]): return 0, 0 |