Modifications

Sauter à la navigation Sauter à la recherche
2 046 octets ajoutés ,  22 juin 2016 à 18:33
Page créée avec « {{RASP-PiTFT-PLUS-NAV}} == Truc et astuces Pygame pour le PiTFT == Since the PiTFT screen is fairly small, you may need to write custom UI programs. Pygame is the easies... »
{{RASP-PiTFT-PLUS-NAV}}

== Truc et astuces Pygame pour le PiTFT ==

Since the PiTFT screen is fairly small, you may need to write custom UI programs. Pygame is the easiest way by far to do this.

Jeremy Blythe has an excellent tutorial here on getting started.

However, before you follow that link you'll want to set up pygame for the best compatibility:

== Installer pip & pygame ==
Pour installer pip

sudo apt-get install python-pip

{{ADFImage|RASP-PiTFT-Pygame-00.jpg}}


Installer Pygame:

sudo apt-get install python-pygame

(ce qui prend un temps certain)

{{ADFImage|RASP-PiTFT-Pygame-01.jpg}}

== Utiliser la SDL 1.2 ==
'''Assurez-vous de bien utiliser la SDL 1.2'''

SDL 2.x et SDL 1.2.15-10 ont quelques sérieuses incompatibilités avec l'écran tactile. Vous pouvez forcer l'utilisation de la SDL 1.2 en exécutant le script suivant. ([https://forums.adafruit.com/viewtopic.php?f=47&t=76169&p=439894#p435225 Merci à heine, dans le Forums Adafruit]!)

Editer un nouveau fichier avec {{fname|sudo nano installsdl.sh}}

et copier le texte suivant à l'intérieur:

<syntaxhighlight lang="bash">
#!/bin/bash

#enable wheezy package sources
echo "deb http://archive.raspbian.org/raspbian wheezy main
" > /etc/apt/sources.list.d/wheezy.list

#set stable as default package source (currently jessie)
echo "APT::Default-release \"stable\";
" > /etc/apt/apt.conf.d/10defaultRelease

#set the priority for libsdl from wheezy higher then the jessie package
echo "Package: libsdl1.2debian
Pin: release n=jessie
Pin-Priority: -10
Package: libsdl1.2debian
Pin: release n=wheezy
Pin-Priority: 900
" > /etc/apt/preferences.d/libsdl

#install
apt-get update
apt-get -y --force-yes install libsdl1.2debian/wheezy
</syntaxhighlight>

Ensuite, exécutez les commandes suivantes:

sudo chmod +x installsdl.sh
sudo ./installsdl.sh

{{ADFImage|RASP-PiTFT-Pygame-20.jpg}}

Ce qui force l'installation de la SDL 1.2

{{ADFImage|RASP-PiTFT-Pygame-21.jpg}}

OK '''maintenant''' vous pouvez continuer à utiliser pygame

{{RASP-PiTFT-PLUS-TRAILER}}
29 922

modifications

Menu de navigation