Outils pour utilisateurs

Outils du site


issue60:tuto_python

I must say, I love my Android tablet. While I use it every day, it's not yet a replacement for my desktop. And I must also admit, most of what I use it for is pretty much what everyone uses theirs for: web browsing, listening to music, watching videos, playing games, and so on. I try to justify it by having apps that deal with grocery and todo lists, finding cheap gas, fun things for our grandson, etc. It's really a toy for me right now. Why use a fancy touch-screen tablet to do your grocery list? Let's face it… it's the cool looks of envy that people give me in the store when they see me rolling the cart down the aisle and I tap my tablet to mark items off the list. Ahh— the geek factor RULES! Of course, I can use the back of an old envelope to hold my list. But that wouldn't be cool and geeky, now, would it?

Je dois l'avouer, j'aime ma tablette Android. Alors que je l'utilise tous les jours, elle n'est pas encore un remplaçant pour mon ordinateur de bureau. Et je dois aussi admettre que ce pourquoi je l'utilise principalement est à peu près ce pourquoi tout le monde utilise la sienne : naviguer sur le web, écouter de la musique, regarder des vidéos, jouer à des jeux et ainsi de suite. J'essaie de la justifier en ayant des applications qui ont un rapport avec des listes de course et de tâches à faire, la recherche d'essence pas chère, des choses amusantes pour notre petit-fils, etc. C'est vraiment un jouet pour moi en ce moment. Pourquoi utiliser une tablette tactile amusante pour faire votre liste de courses ? Avouons-le… ce sont les regards d'envie que les gens me jettent dans le magasin quand ils me voient rouler le caddy dans l'allée et tapoter ma tablette pour barrer les éléments de la liste. Ahh — le facteur geek RÈGNE ! Bien sûr, je peux utiliser le dos d'une vieille enveloppe pour faire ma liste. Mais ce ne serait ni cool ni geeky, hein, n'est-ce pas ?

Like 99% of geeky married men in the world, I am married to a non-geek woman. A wonderful loving woman, to be sure, but a non-geek who, when I start drooling at the latest gadget, sighs, and says something like “Well, if you REALLY think we need that…”. Then she gives me the same look I give her as she is lovingly fondles the 50th pair of shoes at the store. In all honesty, it wasn't hard to get the first tablet into our house. I bought it for my wife while she was going through chemotherapy. She tried to use a laptop for a while, but the heat and weight on her lap was too much after a while. E-books on a laptop for her wasn't an option, so when she tried to read, she had to juggle the book, and the laptop, and the mp3 player. All while being tied to a recliner with tubes running into her arm filling her with nasty chemicals. When I got her the tablet, it was the best of all worlds. She could read an e-book, listen to music, watch a TV show, browse the web, check her E-mail, update her cancer blog, follow her friends on facebook, and play games - all on a device that was light and cool. If she got tired, she could just slip it off to the side between her and the recliner (or bed when she was home trying to regain strength). MUCH better than a bulky laptop, and book, mp3 player, remote control, and more.

Comme 99 % des hommes geeks mariés dans le monde, je suis marié à une femme non-geek. Une merveilleuse femme aimante, bien sûr, mais une non-geek qui, lorsque je commence à baver sur le dernier gadget, soupire et dit quelque chose comme : « Eh bien, si tu penses VRAIMENT que nous avons besoin de ça… ». Puis elle m'envoie le même regard que je lui envoie quand elle caresse affectueusement la 50e paire de chaussures du magasin. En toute honnêteté, il n'a pas été difficile de ramener la première tablette à la maison. Je l'ai achetée pour ma femme alors qu'elle suivait un traitement de chimiothérapie. Elle a essayé d'utiliser un ordinateur portable pendant quelques temps, mais la chaleur et le poids sur ses genoux étaient insupportables au bout d'un certain temps. Les e-books sur un ordinateur portable n'étaient pas une option, alors quand elle a essayé de lire, elle a dû jongler entre le livre, l'ordinateur portable, et le lecteur mp3. Tout en étant attachée à un transat avec des tubes dans le bras la remplissant de vilains produits chimiques. Lorsque je lui ai offert la tablette, ce fut le meilleur des mondes. Elle pouvait lire un livre électronique, écouter de la musique, regarder la télé, naviguer sur le Web, vérifier ses mails, mettre à jour son blog sur le cancer, suivre ses amis sur facebook et jouer à des jeux, le tout sur un appareil qui était léger et sympa. Si elle était fatiguée, elle pouvait tout simplement la glisser sur le côté entre elle et le transat (ou le lit quand elle était à la maison pour essayer de reprendre des forces). Bien mieux qu'un ordinateur portable encombrant et un livre, un lecteur mp3, une télécommande, et plus encore.

As she was getting pumped full of noxious chemicals, I would commandeer a table and chair in the corner of the treatment room, near a power outlet, and try to work on my six-year old laptop. In between projects, I would do research on Android programming. I found out that most programming for Android is done in Java. I had almost resigned myself to re-learning Java when I stumbled across a few tools that allow Python programming for the Android Operating system. One of these tools is called “SL4A”. SL4A stands for Scripting Layer for Android. That's what we will concentrate on in the next couple of articles. We'll really focus on getting SL4A set up on Android in this one. You might ask, why in the world I would be talking about Android programming in a magazine designed for Linux. Well, the simple reason is that the core of Android is Linux. Everything that Android is, sits on top of Linux!

Alors qu'elle se faisait remplir de produits chimiques nocifs, je réquisitionnais une table et une chaise dans le coin de la salle de traitement, à proximité d'une prise de courant, et j'essayais de travailler sur mon vieux portable de six ans. Entre les projets, je faisais des recherches sur la programmation Android. J'ai découvert que la plupart des programmes pour Android se faisait en Java. J'étais presque résigné à ré-apprendre Java lorsque je suis tombé sur quelques outils qui permettent de programmer en Python pour le système d'exploitation Android. Un de ces outils est appelé « SL4A ». SL4A veut dire Scripting Layer for Android (Couche de Script pour Android). C'est ce sur quoi nous allons nous concentrer dans les deux prochains articles. Dans celui-ci, en fait, nous allons nous concentrer sur la mise en place de SL4A sous Android.

Many web pages show how to load SL4A into the Android Emulator for Desktops. We'll look at doing that another time, but for now we'll deal with the Android device itself. To install SL4A on your Android device, go to http://code.google.com/p/android-scripting/; you'll find the installation file for SL4A. Don't be absolutely confused here. There's a square High Density barcode that you tap to download the APK. Be sure that you have the “Unknown Sources” option enabled in the Application settings. It's a quick download. Once you have it downloaded and installed, go ahead and find the icon, and tap it. What you will see is a rather disappointing black screen saying “Scripts…No matches found”. That's OK. Hit the menu button and select View. You'll see a menu. Select Interpreters. Then select menu again, and select Add. From the next menu, select Python 2.6.2. This should ask you to start a browser session to download Python for Android. Once this is installed, select Open. You'll get a screen menu with the options to Install, Import Modules, Browse Modules, and Uninstall modules. Select Install. Now Python will download and install along with other extra modules. In addition, you'll get some sample scripts. Finally, tap the back button and you'll see Python 2.6.2 installed in the interpreters screen. Tap again on the back button and you'll see a list of some sample python scripts. That's all we are going to do this time. All I wanted to do is whet your appetite. Explore Python on Android. You might also want to visit http://developer.android.com/sdk/index.html to get the Android SDK (Software Development Kit) for your desktop. It includes an Android Emulator so you can play along. Setting up the SDK is really pretty easy on Linux, so you shouldn't have too much trouble.

De nombreuses pages web montrent comment charger SL4A dans l'émulateur Android pour ordinateur de bureau. Nous allons essayer de faire cela une autre fois, mais pour l'instant nous allons jouer avec l'appareil Android lui-même. Pour installer SL4A sur votre appareil Android, allez à http://code.google.com/p/android-scripting/; vous y trouverez le fichier d'installation pour SL4A. Ne soyez pas totalement perdu ici. Il y a un code-barres carré à haute densité sur lequel vous appuyez pour télécharger l'APK. Assurez-vous d'avoir activé l'option « Unknown Sources (Sources inconnues) » dans les paramètres Application. C'est un téléchargement rapide. Une fois que vous l'avez téléchargé et installé, trouvez l'icône et appuyez dessus. Ce que vous verrez est un écran noir, plutôt décevant, disant « Scripts…No matches found » (Scripts … Aucune correspondance trouvée). C'est pas grave. Cliquez sur le bouton menu et sélectionnez View (Afficher). Vous verrez un menu. Sélectionnez Interpreters (interprètes). Ensuite, sélectionnez de nouveau le menu, puis sélectionnez Add (Ajouter). Dans le menu suivant, sélectionnez Python 2.6.2. Cela devrait vous demander de lancer un navigateur pour télécharger Python pour Android. Une fois qu'il est installé, sélectionnez Open (Ouvrir). Vous obtiendrez un menu à l'écran avec les choix Install, Import Modules, Browse Modules (parcourir les modules), et Uninstall Modules. Sélectionnez l'option Install. Maintenant Python va se télécharger et s'installer avec d'autres modules supplémentaires. De plus, vous aurez des exemples de scripts. Enfin, appuyez sur le bouton de retour et vous verrez Python 2.6.2 installé dans l'écran des interprètes. Appuyez de nouveau sur le bouton de retour et vous verrez une liste de quelques exemples de scripts python.

C'est tout ce que nous allons faire cette fois-ci. Tout ce que je voulais faire, c'était de vous mettre en appétit. Explorez Python sous Android. Vous pouvez également visiter http://developer.android.com/sdk/index.html pour obtenir le SDK Android (Software Development Kit) pour votre bureau. Il comprend un émulateur Android afin que vous puissiez jouer avec tout de suite. La mise en place du SDK est vraiment très facile sous Linux et vous ne devriez pas avoir trop de mal.

How to Include Accents from the Keyboard by Barry Smith If your Linux system is in French, German, or Spanish, and, therefore, requiring accents, or if, occasionally, you need to use accents which do not appear in English words, many users do not know that there is a very easy way to do this from the keyboard. The following applies to only the UK keyboard. Acute accent Press Alt Gr + ; (semi-colon) Lift hand then press the desired vowel é Circumflex Press Alt Gr + ' (apostrophe) Lift hand then press the desired vowel î Grave accent Press Alt Gr + # (hache) Lift hand then press the desired vowel è

Comment inclure des accents à partir du clavier par Barry Smith

Si votre système Linux est en français, allemand ou espagnol et, par conséquent, exige des accents, ou si, de temps en temps, vous avez besoin d'utiliser des accents qui ne figurent pas dans les mots anglais, de nombreux utilisateurs ne savent pas qu'il existe un moyen très facile pour le faire à partir du clavier. Ce qui suit ne s'applique qu'à un clavier du Royaume-Uni.

Accent aigu Appuyez sur Alt Gr + ; (point-virgule) Levez la main puis appuyez sur la voyelle souhaitée é.

Accent circonflexe Appuyez sur Alt Gr + ' (apostrophe) Levez la main puis appuyez sur la voyelle souhaitée î.

Accent grave Appuyez sur Alt Gr + # (dièse) Levez la main pui appuyez sur la voyelle souhaitée è.

Umlaut Press Alt Gr + [ Lift hand then press u ü ñ - Press Alt Gr + ] Lift hand then press n ñ œ - Press Shift + Alt Gr Lift hand then press o then press e œ The œ will not appear until after the e is keyed. To get ¿ and ¡ (inverted exclamation mark) which I use all the time in Spanish before questions, and exclamations, press Alt Gr + Shift, keeping both keys pressed, then hit _ (underscore) for ¿ or hit ! (exclamation mark) for ¡. If you want any of these in capitals, just press Shift before keying in the letter.

Trema Appuyez sur Alt Gr + [ Levez la main puis appuyez sur u ü.

ñ - Appuyez sur Alt Gr + ] Levez la main puis appuyez sur n ñ.

œ - Appuyez sur Maj + Alt Gr Levez la main puis appuyez sur o puis appuyez sur e œ. Le œ n'apparaîtra pas jusqu'à ce que le e soit tapé.

Pour obtenir ¿ et ¡ (point d'exclamation et d'interrogation inversés) dont je me sers tout le temps en espagnol avant les questions et les exclamations, appuyez sur Alt Gr + Maj, en gardant les deux touches enfoncées, puis appuyez sur _ (souligné) pour ¿ ou tapez ! (point d'exclamation) pour ¡.

Si vous voulez une de ces lettres en capitales, il suffit d'appuyer sur Maj avant de taper de la lettre.

issue60/tuto_python.txt · Dernière modification : 2012/05/10 17:11 de auntiee