Modifications

Sauter à la navigation Sauter à la recherche
1 385 octets ajoutés ,  29 juin 2016 à 11:20
aucun résumé de modification
Ligne 2 : Ligne 2 :     
{{traduction}}
 
{{traduction}}
 +
 +
{{#Widget:Iframe
 +
|url=https://www.youtube.com/embed/2555IMePGgA
 +
|width=420
 +
|height=315
 +
|border=0
 +
}}
 +
 +
 +
Before diving in to this tutorial, first follow the setup instructions for your PiTFT. Make sure to choose the correct guide particularly for '''resistive''' vs '''capacitive''' displays and carefully follow the section on [https://wiki.mchobby.be/index.php?title=RASP-PiTFT-Pygame Truc et Astuce Pygame - vous aurez besoin de la SDL SDL 1.2!]]
 +
 +
You can also grab all the tutorial source code from git:
 +
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/jerbly/tutorials.git
 +
</syntaxhighlight>
 +
 +
To test the display you can run through these steps in the python console:
 +
 +
<syntaxhighlight lang="python">
 +
pi@raspberrypi ~ $ sudo python
 +
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
 +
[GCC 4.6.3] on linux2
 +
Type "help", "copyright", "credits" or "license" for more information.
 +
>>> import pygame
 +
>>> import os
 +
>>> os.putenv('SDL_FBDEV', '/dev/fb1')
 +
>>> pygame.init()
 +
(6, 0)
 +
>>> lcd = pygame.display.set_mode((320, 240))
 +
>>> lcd.fill((255,0,0))
 +
<rect(0, 0, 320, 240)>
 +
>>> pygame.display.update()
 +
>>> pygame.mouse.set_visible(False)
 +
1
 +
>>> lcd.fill((0,0,0))
 +
<rect(0, 0, 320, 240)>
 +
>>> pygame.display.update()
 +
</syntaxhighlight>
 +
 +
You can also run this test (with a one second sleep) from the pygamelcd project:
 +
 +
<syntaxhighlight lang="bash">
 +
sudo python test1.py
 +
</syntaxhighlight>
    
{{RASP-PYGAME-GUI-TRAILER}}
 
{{RASP-PYGAME-GUI-TRAILER}}
29 917

modifications

Menu de navigation